diff -Nru cloc-1.53/AUTHORS cloc-1.60/AUTHORS --- cloc-1.53/AUTHORS 1970-01-01 00:00:00.000000000 +0000 +++ cloc-1.60/AUTHORS 2013-08-16 21:19:56.000000000 +0000 @@ -0,0 +1 @@ +Al Danial , diff -Nru cloc-1.53/COPYING cloc-1.60/COPYING --- cloc-1.53/COPYING 1970-01-01 00:00:00.000000000 +0000 +++ cloc-1.60/COPYING 2013-08-16 21:19:56.000000000 +0000 @@ -0,0 +1,339 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Lesser General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + 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., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) year name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + , 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. diff -Nru cloc-1.53/INSTALL cloc-1.60/INSTALL --- cloc-1.53/INSTALL 1970-01-01 00:00:00.000000000 +0000 +++ cloc-1.60/INSTALL 2013-08-16 21:19:56.000000000 +0000 @@ -0,0 +1,30 @@ +Adjust prefix variables to install to other than system default: + + make [-n] [prefix=/usr/local] install + +For more information, use: + + make help + + +Dependencies: + +cloc depends on two Perl modules, Algorithm::Diff and Regexp::Common. +If cloc cannot find these at runtime, it will install portions of +these modules embedded in the cloc source code to temporary directories, +then delete these temporary installations after the cloc run completes. +cloc will start more quickly if these modules are already installed on +the target system. These commands will tell whether or not the modules +are installed: + + perl -MAlgorithm::Diff -e 'print "$Algorithm::Diff::VERSION\n"' + perl -MRegexp::Common -e 'print "$Regexp::Common::VERSION\n"' + +If a version number appears, the module in question is available. + +Additionally, cloc will look for the Digest::MD5 module to help +identify duplicate files. If this module is not available, +duplicate file checks are skipped. To test for the existence +of Digest::MD5 use + + perl -MDigest::MD5 -e 'print "$Digest::MD5::VERSION\n"' diff -Nru cloc-1.53/Makefile cloc-1.60/Makefile --- cloc-1.53/Makefile 1970-01-01 00:00:00.000000000 +0000 +++ cloc-1.60/Makefile 2013-08-16 21:19:56.000000000 +0000 @@ -0,0 +1,136 @@ +#!/usr/bin/make -f +# +# Copyright information +# +# Copyright (C) 2012 Jari Aalto +# +# License +# +# 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, see . + +ifneq (,) +This makefile requires GNU Make. +endif + +PACKAGE = cloc + +DESTDIR = +prefix = /usr +exec_prefix = $(prefix) +man_prefix = $(prefix)/share +mandir = $(man_prefix)/man +bindir = $(exec_prefix)/bin +sharedir = $(prefix)/share + +BINDIR = $(DESTDIR)$(bindir) +DOCDIR = $(DESTDIR)$(sharedir)/doc +LOCALEDIR = $(DESTDIR)$(sharedir)/locale +SHAREDIR = $(DESTDIR)$(sharedir)/$(PACKAGE) +LIBDIR = $(DESTDIR)$(prefix)/lib/$(PACKAGE) +SBINDIR = $(DESTDIR)$(exec_prefix)/sbin +ETCDIR = $(DESTDIR)/etc/$(PACKAGE) + +# 1 = regular, 5 = conf, 6 = games, 8 = daemons +MANDIR = $(DESTDIR)$(mandir) +MANDIR1 = $(MANDIR)/man1 +MANDIR5 = $(MANDIR)/man5 +MANDIR6 = $(MANDIR)/man6 +MANDIR8 = $(MANDIR)/man8 + +BIN = $(PACKAGE) +PL_SCRIPT = $(BIN) + +INSTALL_OBJS_BIN = $(PL_SCRIPT) +INSTALL_OBJS_MAN = *.1 + +INSTALL = /usr/bin/install +INSTALL_BIN = $(INSTALL) -m 755 +INSTALL_DATA = $(INSTALL) -m 644 + +all: man + @echo "Nothing to compile for a Perl script." + @echo "Try 'make help' or 'make -n DESTDIR= prefix=/usr/local install'" + +# Rule: help - display Makefile rules +help: + @grep "^# Rule:" Makefile | sort + +# Rule: clean - remove temporary files +clean: + # clean + rm -f *[#~] *.\#* *.x~~ pod*.tmp *.1 + rm -rf tmp + +distclean: clean + +realclean: clean + +# Rule: man - Generate or update manual page +man: + make -f pod2man.mk PACKAGE=$(PACKAGE) makeman + +# Rule: doc - Generate or update all documentation +doc: man + +# Rule: test-perl - Check program syntax +test-perl: + # perl-test - Check syntax + perl -cw $(PL_SCRIPT) + +# Rule: test-pod - Check POD syntax +test-pod: + podchecker *.pod + +# Rule: test - Run tests +test: test-perl test-pod + +install-man: test-pod man + # install-man + $(INSTALL_BIN) -d $(MANDIR1) + $(INSTALL_DATA) $(INSTALL_OBJS_MAN) $(MANDIR1) + +install-bin: test-perl + # install-bin - Install programs + $(INSTALL_BIN) -d $(BINDIR) + for f in $(INSTALL_OBJS_BIN); \ + do \ + dest=$${f%.pl}; \ + $(INSTALL_BIN) $$f $(BINDIR)/$$dest; \ + done + +# Rule: install - Standard install +install: install-bin install-man + +# Rule: install-test - for Maintainer only +install-test: + rm -rf tmp + make DESTDIR=$$(pwd)/tmp prefix=/usr install + find tmp | sort + +# Rule: dist - for Maintainer only, make distribution +dist: clean + [ -f version ] || fail-version-file-is-missing + + release=$(PACKAGE)-$$(cat version); \ + rm -rf /tmp/$$release ; \ + mkdir -vp /tmp/$$release ; \ + cp -rav . /tmp/$$release/ ; \ + find /tmp/$$release/ -type d \ + \( -name .svn -o -name .git -o -name .hg \) | xargs -r rm -r; \ + tar -C /tmp -zvcf /tmp/$$release.tar.gz $$release ; \ + echo "DONE: /tmp/$$release.tag.gz" + +.PHONY: clean distclean realclean install install-bin install-man + +# End of file diff -Nru cloc-1.53/NEWS cloc-1.60/NEWS --- cloc-1.53/NEWS 1970-01-01 00:00:00.000000000 +0000 +++ cloc-1.60/NEWS 2013-08-16 21:19:56.000000000 +0000 @@ -0,0 +1,392 @@ + Release Notes for cloc version 1.60 + http://cloc.sourceforge.net + August 16, 2013 + +New Languages: + o LESS + o Razor + o JavaServer Faces + o SASS + o Apex Trigger + o Visualforce Component + o Visualforce Page + o Verilog-SystemVerilog + o Pig Latin + +Updates: + o Improved handling of UTF-16 (both little and big endian). + o use Time::HiRes if available. + o Improved logic that distinguishes between Objective C, + MUMPS and MATLAB files. + o Added information about duplicate files to output created + by --ignored. + o Added support for .tar.xz compressed archives. + o CMake Added .cmake file extension. + o MXML Added support for Actionscript + o Groovy Added .gant file extension. + o Vala Recognize Vala header files. + +New options and features: + + --max-file-size= Skip files larger than megabytes when + traversing directories. By default, =100. + cloc's memory requirement is roughly twenty times + larger than the largest file so running with + files larger than 100 MB on a computer with less + than 2 GB of memory will cause problems. + Note: this check does not apply to files + explicitly passed as command line arguments. + +Bug Fixes: + + Suppress "Wrote " messages when running with --quiet. + Fixed an error that caused cloc to fail with "Can't use an + undefined value as an ARRAY reference" when running with + Perl 5.16 or newer when it encounters certain file types. + +============================================================================ + Release Notes for cloc version 1.58 + http://cloc.sourceforge.net + March 3, 2013 + +Version 1.58 introduces a new version numbering scheme: odd numbers +represent development versions while even numbers represent stable, +released versions. There was no release 1.57 as it was the development +version leading to this release. + +New Languages: + o Ant + o Arduino Sketch + o InstallShield + o Maven + o PowerShell + o Rust + o Vala + +Updates: + o OCaml Added extensions .mli, .mly, .mll + o --read-lang-def See the section --read-lang-def v. + --force-lang-def below. + +New options and features: + + --diff-timeout N + o Running diff on large files with many repeated lines may + cause Algorithm::Diff::sdiff() to run for hours. This + option sets the upper time limit on the duration of this + operation for a single file pair. Default is 10 seconds. + + --force-lang-def FILE + o See the section --read-lang-def v. --force-lang-def below. + + --skip-archive REGEX + o Ignore files that end with the given Perl regular expression. + For example, if given --skip-archive='(zip|tar(.(gz|Z|bz2|xz|7z))?)' + the code will skip files that end with .zip, .tar, .tar.gz, + .tar.Z, .tar.bz2, .tar.xz, and .tar.7z (feature req. 32). + + Prevent "defined(@array) is deprecated" warnings with Perl 5.16.1. + + Show an example of alternation in the documentation for the --match-d + switch. + + +--read-lang-def v. --force-lang-def + + The --read-lang-def option allows one to replace cloc's language + processing filters with custom settings. The problem with this + option is that it overwrites internal logic that handles languages + which map to the same file extension. Currently these are + MATLAB/Objective C/MUMPS -> .m + Pascal/PHP -> .inc + Lisp/OpenCL -> .cl + The logic needed to handle these extension collisions is not + easily expressed in an input text file. In any event, in most + instances one merely wishes to augment cloc's language definitions + with entries for new languages rather than replace definitions + for known languages. + + For this reason, the behavior of --read-lang-def has been changed + to merge new language definitions found in the given file with + cloc's existing languages. Where there are conflicts, cloc's + built-in definitions take precedence. This new behavior allows + one to add new language definitions without sacrificing cloc's + ability to count files languages ending with .m, .inc, or .cl. + + The new option --force-lang-def behaves exactly like --read-lang-def + did in cloc versions 1.56 and earlier--it completely ignores + cloc's internal language definitions and repaces them with definitions + in the given file. However, one will no longer be able to count + files with the extensions .m, .inc, or .cl. + +Bug Fixes: + + Suppress "Wrote " messages when running with --quiet. + + Create .file output when running with --sum-reports (id 3571353). + + Correct output for languages starting with a lower case letter when + running with --diff --sum-reports. + + Show correct count of files added/deleted with --diff (id 78). + + Handle special case of --diff between one file and a set of files (id 82). + + Prevent cloc from inadvertently counting lines from temporary + installations of Algorithm::Diff and/or Regexp::Common. This happens + on faulty Perl installations (eg. MinGW MSYS Perl) which cause + File::Temp::tempdir() to return the current working directory. + +============================================================================ + Release Notes for cloc version 1.56 + http://cloc.sourceforge.net + April 3, 2012 + +Version 1.56 introduces an additional documentation file, cloc.1.pod, which +can be used to produce cloc's documentation in the style of a Unix man page, +plain text, HTML, or LaTeX. + +New Languages: + o Clojure + o ClojureScript + o AutoHotkey + o QML + o CFScript + o OpenCL + +New options and features: + + --unix + o Override the operating system autodetection logic and run in + UNIX mode. + + --windows + o Override the operating system autodetection logic and run in + Microsoft Windows mode. + + --show-os + o Print the name of the of the operating system mode and exit. + + --csv-delimiter + o Use the provided delimiter instead of a comma when generating + csv output. + + --stdin-name + o On UNIX systems, enables cloc to count code piped in via STDIN. + This switch provides a filename for to use to infer the language. + + .git subdirectories are now ignored. + + Updated yacc counter to recognize C99 comments. + + Improved detection and reporting of ignored zero sized files. + + Removed spurious from YAML output. + + Fixed handling of multi-line Ruby comments surrounded by =begin/=end. + + Associated .ctl and .dsr extensions with Visual Basic + +Bug Fixes: + + Produce correct diff results when comparing empty files with populated + files. + + Remove temporary directory names from --by-file output when working + with archive files. + + Honor user's requested scratch directory if given --sdir. + +============================================================================ + Release Notes for cloc version 1.55 + http://cloc.sourceforge.net + October 14, 2011 + +Version 1.55 is a bugfix release to correct malformed XML output +that was introduced in the 1.54 release. Two minor enhancements +were added: + +New Languages: + o Dart + +New options and features: + + --sum-one + o Force printing of the SUM: line even if only one source + file is counted. + +============================================================================ + Release Notes for cloc version 1.54 + http://cloc.sourceforge.net + October 1, 2011 + + +New Languages: + o CMake + o Cython + o Objective C++ + o Ocaml + o Smarty + +New options and features: + + --autoconf + o Count files of recognized languages that end with ".in" + (for example, code.h.in, Makefile.in) as used by GNU + automake/autoconf. + + --match-d, --not-match-d + o Include, or skip over, directories whose names match + provided regular expressions. + + --follow-links + o Follow symbolic links (on Unix-like OS's). + + YAML and XML output: header lines now include the cloc URL, + version, # lines and files counted, etc. + + YAML and XML output: if writing to a file (rather than STDOUT), + save the file name as an element inside the file. + + Include support for languages with double extensions. First + implementation of these uses .spc.sql for SQL Stored Procedures + and .data.sql as SQL Data as distinct from just SQL. + + Handle archive files (tar files, zip files, etc) with spaces + in their names. + +Bug Fixes: + + Lisp: Include .lisp as a valid file extension. + + Correctly identify operating system as Windows if MKS Toolkit is + installed. + + Fix incorrectly handled .inc files (could be PHP or Pascal). + + --counted + o Correct output to show only files which were actually + used to produce the code count. Also show the output + by language rather than by filename. + + --diff + o Fixed null output when one input has a single file while + the comparison input has multiple files. + o Fixed null output when no lines of code are modified in + common files (only entire files were added or removed). + o Handle cases where one of the two inputs is an empty + file or directory. + + --diff + --exclude-file-list + o --diff now skips files defined by --exclude-file-list + + --diff + --exclude-lang + o --diff now skips languages defined by --exclude-lang + + --diff + --xml + o Include user-provided xsl file name in XML --diff output. + o XML output for --by-file and --by-file-by-lang. + + --diff + --csv + o Added comma separated value output for --diff. + + --diff + --sum-reports + o Can now use the --sum-reports option with --diff. + + --exclude-dir + o Quote metacharacters when comparing directory names against + --exclude-dir value. + + --strip-comments + o Do not remove blank lines if they follow lines with + (language-dependent) continuation markers. + + --sum-reports + --list-file + o Allow the --sum-reports option to take its inputs from + files defined by --list-file + +Outstanding issues: + --sql output formats remain unimplemented for --diff. + +============================================================================ + Release Notes for cloc version 1.53 + http://cloc.sourceforge.net + +New Languages: + o Go + o MXML + +New options: + + --lang-no-ext + o Alternate method to count files without file + extension. + --ignore-case + o Works with --diff; treat uppercase and lowercase text + as equivalent. + +Bug Fixes: + + Pascal: Add // as a comment marker. + IDL: Include .pro as a recognized file extension. + + --3: + o Correct XSLT syle when running with --3. + + --diff: + o Implemented YAML output option. + o Implemented XML output option. Includes an optional + default XSLT style file. + o Include code/comment/blank counts of added files to + total added material and include code/comment/blank + counts of removed files to total removed material. + o Ignore unrecognized languages. + + --exclude-ext + o Was inadvertently disabled in v1.52; works now. + +Outstanding issues: + --csv, --sql output formats remain unimplemented for --diff. + +============================================================================ + Release Notes for cloc version 1.52 + http://cloc.sourceforge.net + +New Languages: + o Groovy + o Scala + o XAML + +New options: + + --exclude-ext + o Ignore files with the given file extension. + + --ignore-whitespace + o Works with --diff; ignore whitespace in code and comments + when computing differences. + +Bug Fixes: + + Fortran: Treat line starting with an exclamation mark as a comment. + Cobol: Treat page eject directive and any line with characters + in columns 1-6 as a blank line. + + --diff: + o Fix negative value of removed blank lines. + o Better output column alignment when running with --by-file. + o Bug fixes when dealing with fully qualified Windows paths. + + --exclude-list-file + o Can now also include directories to ignore in the supplied + input file. + +Other Improvements: + o Better logic to select the file whose name identifies it as + containing source code when the file is one of several having + identical contents (for example, if main.c and main.c.bak have + identical contents, choose main.c for counting instead of + main.c.bak, which would be rejected because the filename + does not match any recognized language). + o Contents of .hg/ (Mercurial) directories are ignored. + o On Windows: Ignore case in file name extensions. diff -Nru cloc-1.53/README cloc-1.60/README --- cloc-1.53/README 1970-01-01 00:00:00.000000000 +0000 +++ cloc-1.60/README 2013-08-16 21:19:56.000000000 +0000 @@ -0,0 +1,33 @@ +README: cloc - statistics utility to count lines of code +---------------------------------------------------------------- + +Count physical lines of source code in the given files (may be +archives such as compressed tarballs or zip files) and/or recursively +below the given directories. Given two directories or archive +files, it can compute differences of source code and comments +between the code bases. + +Important files + + COPYING GPL v2 or later Licence + INSTALL Install instructions + NEWS Project change records + +Project details + + Homepage + http://freecode.com/projects/cloc (The yellow pages) + http://sourceforge.net/projects/cloc (Devel site) + + To report bugs + See Devel site + + Source code repository + See Devel site + + Depends + Perl (any version). Uses only standard Perl libraries. + CPAN Algorithm::Diff + CPAN Regexp::Common + +End of file diff -Nru cloc-1.53/cloc cloc-1.60/cloc --- cloc-1.53/cloc 2010-10-11 21:41:44.000000000 +0000 +++ cloc-1.60/cloc 2013-08-16 21:19:56.000000000 +0000 @@ -1,6 +1,6 @@ #!/usr/bin/env perl -# cloc -- Count Lines of Code {{{1 -# Copyright (C) 2006-2010 Northrop Grumman Corporation +# cloc -- Count Lines of Code {{{1 +# Copyright (C) 2006-2013 Northrop Grumman Corporation # Author: Al Danial # First release August 2006 # @@ -27,13 +27,10 @@ # 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: -# http://www.gnu.org/licenses/gpl.txt +# . # -# 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 # 1}}} -my $VERSION = sprintf("%.2f", 1.53); +my $VERSION = "1.60"; # odd number == beta; even number == stable my $URL = "http://cloc.sourceforge.net"; require 5.006; # use modules {{{1 @@ -57,6 +54,11 @@ warn "Digest::MD5 not installed; will skip file uniqueness checks.\n"; } +# Time::HiRes became standard with Perl 5.8 +my $HAVE_Time_HiRes = 0; +eval "use Time::HiRes;"; +$HAVE_Time_HiRes = 1 if defined $Time::HiRes::VERSION; + my $HAVE_Rexexp_Common; # Regexp::Common isn't in the standard distribution. It will # be installed in a temp directory if necessary. @@ -114,51 +116,61 @@ use Text::Tabs qw { expand }; use Cwd qw { cwd }; +use File::Glob; +my $PERL_516 = $] >= 5.016 ? 1 : 0; # 5.16 deprecates defined(@array) +no warnings 'deprecated'; # will need to comment this out to test + # each new Perl version # 1}}} # Usage information, options processing. {{{1 my $ON_WINDOWS = 0; $ON_WINDOWS = 1 if ($^O =~ /^MSWin/) or ($^O eq "Windows_NT"); - $ON_WINDOWS = 0 if $ENV{'SHELL'}; # make Cygwin look like Unix - -my $CLOC_XSL = "cloc.xsl"; # created with --xsl +if ($ON_WINDOWS and $ENV{'SHELL'}) { + if ($ENV{'SHELL'} =~ m{^/}) { + $ON_WINDOWS = 0; # make Cygwin look like Unix + } else { + $ON_WINDOWS = 1; # MKS defines $SHELL but still acts like Windows + } +} my $NN = chr(27) . "[0m"; # normal - $NN = "" if $ON_WINDOWS; + $NN = "" if $ON_WINDOWS or !(-t STDERR); # -t STDERR: is it a terminal? my $BB = chr(27) . "[1m"; # bold - $BB = "" if $ON_WINDOWS; + $BB = "" if $ON_WINDOWS or !(-t STDERR); my $script = basename $0; my $usage = " -Usage: $script [options] | +Usage: $script [options] | | - Count physical lines of source code in the given files (may be - archives such as compressed tarballs or zip files) and/or - recursively below the given directories. + Count, or compute differences of, physical lines of source code in the + given files (may be archives such as compressed tarballs or zip files) + and/or recursively below the given directories. ${BB}Input Options${NN} --extract-with= This option is only needed if cloc is unable to figure out how to extract the contents of the input file(s) by itself. Use to extract binary archive files (e.g.: - .tar.gz, .zip, .Z). Use the literal '>FILE<' as + .tar.gz, .zip, .Z). Use the literal '>FILE<' as a stand-in for the actual file(s) to be extracted. For example, to count lines of code - in the input files - gcc-4.2.tar.gz perl-5.8.8.tar.gz - on Unix use + in the input files + gcc-4.2.tar.gz perl-5.8.8.tar.gz + on Unix use --extract-with='gzip -dc >FILE< | tar xf -' or, if you have GNU tar, - --extract-with='tar zxf >FILE<' - and on Windows use: + --extract-with='tar zxf >FILE<' + and on Windows use, for example: --extract-with=\"\\\"c:\\Program Files\\WinZip\\WinZip32.exe\\\" -e -o >FILE< .\" (if WinZip is installed there). - --list-file= Take the list of file and/or directory names to - process from which has one file/directory + --list-file= Take the list of file and/or directory names to + process from which has one file/directory name per line. See also --exclude-list-file. --unicode Check binary files to see if they contain Unicode expanded ASCII text. This causes performance to drop noticably. ${BB}Processing Options${NN} + --autoconf Count .in files (as processed by GNU autoconf) of + recognized languages. --by-file Report results for every source file encountered. --by-file-by-lang Report results for every source file encountered in addition to reporting by language. @@ -167,29 +179,65 @@ may be pairs of files, directories, or archives. Use --diff-alignment to generate a list showing which file pairs where compared. See also - --ignore-whitespace. + --ignore-case, --ignore-whitespace. + --diff-timeout Ignore files which take more than seconds + to process. Default is 10 seconds. + (Large files with many repeated lines can cause + Algorithm::Diff::sdiff() to take hours.) + --follow-links [Unix only] Follow symbolic links to directories + (sym links to files are always followed). --force-lang=[,] - Process all files that have a extension - with the counter for language . For - example, to count all .f files with the - Fortran 90 counter (which expects files to - end with .f90) instead of the default Fortran 77 + Process all files that have a extension + with the counter for language . For + example, to count all .f files with the + Fortran 90 counter (which expects files to + end with .f90) instead of the default Fortran 77 counter, use --force-lang=\"Fortran 90\",f If is omitted, every file will be counted - with the counter. This option can be + with the counter. This option can be specified multiple times (but that is only - useful when is given each time). - See also --script-lang. + useful when is given each time). + See also --script-lang, --lang-no-ext. + --force-lang-def= Load language processing filters from , + then use these filters instead of the built-in + filters. Note: languages which map to the same + file extension (for example: + MATLAB/Objective C/MUMPS; Pascal/PHP; + Lisp/OpenCL) will be ignored as these require + additional processing that is not expressed in + language definition files. Use --read-lang-def + to define new language filters without replacing + built-in filters (see also --write-lang-def). --ignore-whitespace Ignore horizontal white space when comparing files - with --diff. + with --diff. See also --ignore-case. + --ignore-case Ignore changes in case; consider upper- and lower- + case letters equivalent when comparing files with + --diff. See also --ignore-whitespace. + --lang-no-ext= Count files without extensions using the + counter. This option overrides internal logic + for files without extensions (where such files + are checked against known scripting languages + by examining the first line for #!). See also + --force-lang, --script-lang. + --max-file-size= Skip files larger than megabytes when + traversing directories. By default, =100. + cloc's memory requirement is roughly twenty times + larger than the largest file so running with + files larger than 100 MB on a computer with less + than 2 GB of memory will cause problems. + Note: this check does not apply to files + explicitly passed as command line arguments. --read-binary-files Process binary files in addition to text files. This is usually a bad idea and should only be - attempted with text files that have embedded + attempted with text files that have embedded binary data. - --read-lang-def= Load from the language processing filters. - (see also --write-lang-def) then use these filters - instead of the built-in filters. + --read-lang-def= Load new language processing filters from + and merge them with those already known to cloc. + If defines a language cloc already knows + about, cloc's definition will take precedence. + Use --force-lang-def to over-ride cloc's + definitions (see also --write-lang-def ). --script-lang=, Process all files that invoke as a #! scripting language with the counter for language . For example, files that begin with @@ -198,8 +246,9 @@ --script-lang=Perl,perl5.8.8 The language name is case insensitive but the name of the script language executable, , - must have the right case. This option can be - specified multiple times. See also --force-lang. + must have the right case. This option can be + specified multiple times. See also --force-lang, + --lang-no-ext. --sdir= Use as the scratch directory instead of letting File::Temp chose the location. Files written to this location are not removed at @@ -208,19 +257,27 @@ a performance boost at the expense of counting files with identical contents multiple times (if such duplicates exist). + --stdin-name= Give a file name to use to determine the language + for standard input. --strip-comments= For each file processed, write to the current directory a version of the file which has blank lines and comments removed. The name of each - stripped file is the original file name with + stripped file is the original file name with . appended to it. It is written to the current directory unless --original-dir is on. - --original-dir [Only effective in combination with - --strip-comments] Write the stripped files + --original-dir [Only effective in combination with + --strip-comments] Write the stripped files to the same directory as the original files. --sum-reports Input arguments are report files previously created with the --report-file option. Makes a cumulative set of results containing the sum of data from the individual report files. + --unix Override the operating system autodetection + logic and run in UNIX mode. See also + --windows, --show-os. + --windows Override the operating system autodetection + logic and run in Microsoft Windows mode. + See also --unix, --show-os. ${BB}Filter Options${NN} --exclude-dir=[,D2,] Exclude the given comma separated directories @@ -228,30 +285,43 @@ example --exclude-dir=.cache,test will skip all files that have /.cache/ or /test/ as part of their path. - Directories named .cvs and .svn are always - excluded. + Directories named .bzr, .cvs, .hg, .git, and + .svn are always excluded. --exclude-ext=[,[...]] - Do not count files having the given file name + Do not count files having the given file name extensions. --exclude-lang=[,L2,] Exclude the given comma separated languages L1, L2, L3, et cetera, from being counted. - --exclude-list-file= Ignore files and/or directories whose names - appear in . should have one entry - per line. Relative path names will be resolved - starting from the directory where cloc is + --exclude-list-file= Ignore files and/or directories whose names + appear in . should have one entry + per line. Relative path names will be resolved + starting from the directory where cloc is invoked. See also --list-file. - --match-f= Only count files whose basenames match the Perl + --match-d= Only count files in directories matching the Perl + regex. For example + --match-d='/(src|include)/' + only counts files in directories containing + /src/ or /include/. + --not-match-d= Count all files except those in directories + matching the Perl regex. + --match-f= Only count files whose basenames match the Perl regex. For example - --match-f=^[Ww]idget + --match-f='^[Ww]idget' only counts files that start with Widget or widget. --not-match-f= Count all files except those whose basenames match the Perl regex. + --skip-archive= Ignore files that end with the given Perl regular + expression. For example, if given + --skip-archive='(zip|tar(\.(gz|Z|bz2|xz|7z))?)' + the code will skip files that end with .zip, + .tar, .tar.gz, .tar.Z, .tar.bz2, .tar.xz, and + .tar.7z. --skip-win-hidden On Windows, ignore hidden files. ${BB}Debug Options${NN} --categorized= Save names of categorized files to . --counted= Save names of processed source files to . - --diff-alignment= Write to a list of files and file pairs + --diff-alignment= Write to a list of files and file pairs showing which files were added, removed, and/or compared during a run with --diff. This switch forces the --diff mode on. @@ -259,18 +329,20 @@ --found= Save names of every file found to . --ignored= Save names of ignored files and the reason they were ignored to . - --print-filter-stages Print to STDOUT processed source code before and + --print-filter-stages Print to STDOUT processed source code before and after each filter is applied. --show-ext[=] Print information about all known (or just the given) file extensions and exit. --show-lang[=] Print information about all known (or just the given) languages and exit. + --show-os Print the value of the operating system mode + and exit. See also --unix, --windows. -v[=] Verbose switch (optional numeric value). --version Print the version of this program and exit. - --write-lang-def= Writes to the language processing filters then exits. Useful as a first step to creating - custom language definitions (see --read-lang-def). + custom language definitions (see also + --force-lang-def, --read-lang-def). ${BB}Output Options${NN} --3 Print third-generation language output. @@ -286,19 +358,25 @@ --report-file= Write the results to instead of STDOUT. --out= Synonym for --report-file=. --csv Write the results as comma separated values. + --csv-delimiter= Use the character as the delimiter for comma + separated files instead of ,. This switch forces + --csv to be on. --sql= Write results as SQL create and insert statements which can be read by a database program such as - SQLite. If is 1, output is sent to STDOUT. - --sql-project= Use as the project identifier for the + SQLite. If is -, output is sent to STDOUT. + --sql-project= Use as the project identifier for the current run. Only valid with the --sql option. --sql-append Append SQL insert statements to the file specified - by --sql and do not generate table creation + by --sql and do not generate table creation statements. Only valid with the --sql option. + --sum-one For plain text reports, show the SUM: output line + even if only one input file is processed. --xml Write the results in XML. - --xsl[=] Reference as an XSL stylesheet within - the XML output. If is not given, writes - a default stylesheet, $CLOC_XSL. This switch - forces --xml to be on. + --xsl= Reference as an XSL stylesheet within + the XML output. If is 1 (numeric one), + writes a default stylesheet, cloc.xsl (or + cloc-diff.xsl if --diff is also given). + This switch forces --xml on. --yaml Write the results in YAML. "; @@ -309,14 +387,16 @@ # comment and code lines in different colors. $| = 1; # flush STDOUT -my $start_time = time(); +my $start_time = get_time(); my ( $opt_categorized , $opt_found , @opt_force_lang , + $opt_lang_no_ext , @opt_script_lang , $opt_diff , $opt_diff_alignment , + $opt_diff_timeout , $opt_html , $opt_ignored , $opt_counted , @@ -329,6 +409,7 @@ $opt_exclude_lang , $opt_exclude_list_file , $opt_exclude_dir , + $opt_force_lang_def , $opt_read_lang_def , $opt_write_lang_def , $opt_strip_comments , @@ -347,19 +428,32 @@ $opt_xsl , $opt_yaml , $opt_csv , - $opt_match_f , - $opt_not_match_f , - $opt_skip_uniqueness , - $opt_list_file , - $opt_help , - $opt_skip_win_hidden , - $opt_read_binary_files , - $opt_sql , - $opt_sql_append , - $opt_sql_project , - $opt_inline , + $opt_csv_delimiter , + $opt_match_f , + $opt_not_match_f , + $opt_match_d , + $opt_not_match_d , + $opt_skip_uniqueness , + $opt_list_file , + $opt_help , + $opt_skip_win_hidden , + $opt_read_binary_files , + $opt_sql , + $opt_sql_append , + $opt_sql_project , + $opt_inline , $opt_exclude_ext , $opt_ignore_whitespace , + $opt_ignore_case , + $opt_follow_links , + $opt_autoconf , + $opt_sum_one , + $opt_stdin_name , + $opt_force_on_windows , + $opt_force_on_unix , # actually forces !$ON_WINDOWS + $opt_show_os , + $opt_skip_archive , + $opt_max_file_size , # in MB ); my $getopt_success = GetOptions( "by_file|by-file" => \$opt_by_file , @@ -369,13 +463,15 @@ "exclude_lang|exclude-lang=s" => \$opt_exclude_lang , "exclude_dir|exclude-dir=s" => \$opt_exclude_dir , "exclude_list_file|exclude-list-file=s" => \$opt_exclude_list_file , - "extract_with|extract-with=s" => \$opt_extract_with , + "extract_with|extract-with=s" => \$opt_extract_with , "found=s" => \$opt_found , "diff" => \$opt_diff , "diff-alignment|diff_alignment=s" => \$opt_diff_alignment , + "diff-timeout|diff_timeout=i" => \$opt_diff_timeout , "html" => \$opt_html , "ignored=s" => \$opt_ignored , "quiet" => \$opt_quiet , + "force_lang_def|force-lang-def=s" => \$opt_force_lang_def , "read_lang_def|read-lang-def=s" => \$opt_read_lang_def , "show_ext|show-ext:s" => \$opt_show_ext , "show_lang|show-lang:s" => \$opt_show_lang , @@ -396,12 +492,16 @@ "version" => \$opt_version , "write_lang_def|write-lang-def=s" => \$opt_write_lang_def , "xml" => \$opt_xml , - "xsl:s" => \$opt_xsl , + "xsl=s" => \$opt_xsl , "force_lang|force-lang=s" => \@opt_force_lang , + "lang_no_ext|lang-no-ext=s" => \$opt_lang_no_ext , "yaml" => \$opt_yaml , "csv" => \$opt_csv , + "csv_delimeter|csv-delimiter=s" => \$opt_csv_delimiter , "match_f|match-f=s" => \$opt_match_f , "not_match_f|not-match-f=s" => \$opt_not_match_f , + "match_d|match-d=s" => \$opt_match_d , + "not_match_d|not-match-d=s" => \$opt_not_match_d , "list_file|list-file=s" => \$opt_list_file , "help" => \$opt_help , "skip_win_hidden|skip-win-hidden" => \$opt_skip_win_hidden , @@ -412,8 +512,20 @@ "inline" => \$opt_inline , "exclude_ext|exclude-ext=s" => \$opt_exclude_ext , "ignore_whitespace|ignore-whitespace" => \$opt_ignore_whitespace , + "ignore_case|ignore-case" => \$opt_ignore_case , + "follow_links|follow-links" => \$opt_follow_links , + "autoconf" => \$opt_autoconf , + "sum_one|sum-one" => \$opt_sum_one , + "stdin_name|stdin-name=s" => \$opt_stdin_name , + "windows" => \$opt_force_on_windows , + "unix" => \$opt_force_on_unix , + "show_os|show-os" => \$opt_show_os , + "skip_archive|skip-archive=s" => \$opt_skip_archive , + "max_file_size|max-file-size=i" => \$opt_max_file_size , ); $opt_by_file = 1 if defined $opt_by_file_by_lang; +my $CLOC_XSL = "cloc.xsl"; # created with --xsl + $CLOC_XSL = "cloc-diff.xsl" if $opt_diff; die "\n" unless $getopt_success; die $usage if $opt_help; my %Exclude_Language = (); @@ -422,15 +534,25 @@ my %Exclude_Dir = (); %Exclude_Dir = map { $_ => 1 } split(/,/, $opt_exclude_dir ) if $opt_exclude_dir ; -# Forcibly exclude .svn, .cvs, .hg directories. The contents of these +# Forcibly exclude .svn, .cvs, .hg, .git, .bzr directories. The contents of these # directories often conflict with files of interest. $opt_exclude_dir = 1; $Exclude_Dir{".svn"} = 1; $Exclude_Dir{".cvs"} = 1; $Exclude_Dir{".hg"} = 1; -$opt_diff = 1 if $opt_diff_alignment; +$Exclude_Dir{".git"} = 1; +$Exclude_Dir{".bzr"} = 1; +$opt_diff = 1 if $opt_diff_alignment; $opt_exclude_ext = "" unless $opt_exclude_ext; -$opt_ignore_whitespace = 0 unless $opt_ignore_whitespace; +$opt_ignore_whitespace = 0 unless $opt_ignore_whitespace; +$opt_ignore_case = 0 unless $opt_ignore_case; +$opt_lang_no_ext = 0 unless $opt_lang_no_ext; +$opt_follow_links = 0 unless $opt_follow_links; +$opt_diff_timeout =10 unless $opt_diff_timeout; +$opt_csv = 1 if $opt_csv_delimiter; +$ON_WINDOWS = 1 if $opt_force_on_windows; +$ON_WINDOWS = 0 if $opt_force_on_unix; +$opt_max_file_size = 100 unless $opt_max_file_size; # Options defaults: $opt_progress_rate = 100 unless defined $opt_progress_rate; @@ -440,12 +562,12 @@ $opt_v = 1; } if (defined $opt_xsl) { - $opt_xml = 1; - $opt_xsl = $CLOC_XSL unless $opt_xsl; + $opt_xsl = $CLOC_XSL if $opt_xsl eq "1"; + $opt_xml = 1; } my $skip_generate_report = 0; $opt_sql = 0 unless defined $opt_sql; -if ($opt_sql eq "1") { # stream SQL output to STDOUT +if ($opt_sql eq "-" || $opt_sql eq "1") { # stream SQL output to STDOUT $opt_quiet = 1; $skip_generate_report = 1; $opt_by_file = 1; @@ -456,12 +578,14 @@ $skip_generate_report = 1; $opt_sum_reports = 0; } + die $usage unless defined $opt_version or defined $opt_show_lang or defined $opt_show_ext or + defined $opt_show_os or defined $opt_write_lang_def or defined $opt_list_file or - defined $opt_list_file or + defined $opt_xsl or scalar @ARGV >= 1; die "--diff requires at least two arguments\n" if $opt_diff and scalar @ARGV < 2; @@ -476,15 +600,19 @@ my (%Language_by_Extension, %Language_by_Script, %Filters_by_Language, %Not_Code_Extension, %Not_Code_Filename, %Language_by_File, %Scale_Factor, %Known_Binary_Archives, + %EOL_Continuation_re, ); my $ALREADY_SHOWED_HEADER = 0; +my $ALREADY_SHOWED_XML_SECTION = 0; my %Error_Codes = ( 'Unable to read' => -1, 'Neither file nor directory' => -2, 'Diff error (quoted comments?)' => -3, + 'Diff error, exceeded timeout' => -4, ); -if ($opt_read_lang_def) { +if ($opt_force_lang_def) { + # replace cloc's definitions read_lang_def( - $opt_read_lang_def , # Sample values: + $opt_force_lang_def , # Sample values: \%Language_by_Extension, # Language_by_Extension{f} = 'Fortran 77' \%Language_by_Script , # Language_by_Script{sh} = 'Bourne Shell' \%Language_by_File , # Language_by_File{makefile} = 'make' @@ -493,6 +621,7 @@ \%Not_Code_Extension , # Not_Code_Extension{jpg} = 1 \%Not_Code_Filename , # Not_Code_Filename{README} = 1 \%Scale_Factor , # Scale_Factor{Perl} = 4.0 + \%EOL_Continuation_re , # EOL_Continuation_re{C++} = '\\$' ); } else { set_constants( # @@ -505,8 +634,27 @@ \%Not_Code_Filename , # Not_Code_Filename{README} = 1 \%Scale_Factor , # Scale_Factor{Perl} = 4.0 \%Known_Binary_Archives, # Known_Binary_Archives{.tar} = 1 + \%EOL_Continuation_re , # EOL_Continuation_re{C++} = '\\$' + ); +} +if ($opt_read_lang_def) { + # augment cloc's definitions (keep cloc's where there are overlaps) + merge_lang_def( + $opt_read_lang_def , # Sample values: + \%Language_by_Extension, # Language_by_Extension{f} = 'Fortran 77' + \%Language_by_Script , # Language_by_Script{sh} = 'Bourne Shell' + \%Language_by_File , # Language_by_File{makefile} = 'make' + \%Filters_by_Language , # Filters_by_Language{Bourne Shell}[0] = + # [ 'remove_matches' , '^\s*#' ] + \%Not_Code_Extension , # Not_Code_Extension{jpg} = 1 + \%Not_Code_Filename , # Not_Code_Filename{README} = 1 + \%Scale_Factor , # Scale_Factor{Perl} = 4.0 + \%EOL_Continuation_re , # EOL_Continuation_re{C++} = '\\$' ); } +if ($opt_lang_no_ext and !defined $Filters_by_Language{$opt_lang_no_ext}) { + die_unknown_lang($opt_lang_no_ext, "--lang-no-ext") +} # Process command line provided extention-to-language mapping overrides. # Make a hash of known languages in lower case for easier matching. @@ -554,12 +702,20 @@ $Not_Code_Extension{$ext} = 1; } -# If SQL output is requested, keep track of directory names generated by -# File::Temp::tempdir and used to temporarily hold the results of compressed -# archives. Contents of the SQL table 't' will be much cleaner if these -# meaningless directory names are stripped from the front of files pulled -# from the archives. +# If SQL or --by-file output is requested, keep track of directory names +# generated by File::Temp::tempdir and used to temporarily hold the results +# of compressed archives. Contents of the SQL table 't' will be much +# cleaner if these meaningless directory names are stripped from the front +# of files pulled from the archives. my %TEMP_DIR = (); +my $TEMP_OFF = 0; # Needed for --sdir; keep track of the number of + # scratch directories made in this run to avoid + # file overwrites by multiple extractions to same + # sdir. +# Also track locations where temporary installations, if necessary, of +# Algorithm::Diff and/or Regexp::Common are done. Make sure these +# directories are not counted as inputs (ref bug #80 2012-11-23). +my %TEMP_INST = (); # invert %Language_by_Script hash to get an easy-to-look-up list of known # scripting languages @@ -575,15 +731,51 @@ @ARGV = windows_glob(@ARGV) if $ON_WINDOWS; #print "after glob have [", join(",", @ARGV), "]\n"; +# filter out archive files if requested to do so +if (defined $opt_skip_archive) { + my @non_archive = (); + foreach my $candidate (@ARGV) { + if ($candidate !~ m/${opt_skip_archive}$/) { + push @non_archive, $candidate; + + } + } + @ARGV = @non_archive; +} + +if ($opt_sum_reports and $opt_diff) { + my @results = (); + if ($opt_list_file) { # read inputs from the list file + my @list = read_list_file($opt_list_file); + @results = combine_diffs(\@list); + } else { # get inputs from the command line + @results = combine_diffs(\@ARGV); + } + if ($opt_report_file) { + write_file($opt_report_file, @results); + } else { + print "\n", join("\n", @results), "\n"; + } + exit; +} if ($opt_sum_reports) { my %Results = (); foreach my $type( "by language", "by report file" ) { - my $found_lang = combine_results(\@ARGV, - $type, - \%{$Results{ $type }}, - \%Filters_by_Language ); + my $found_lang = undef; + if ($opt_list_file) { # read inputs from the list file + my @list = read_list_file($opt_list_file); + $found_lang = combine_results(\@list, + $type, + \%{$Results{ $type }}, + \%Filters_by_Language ); + } else { # get inputs from the command line + $found_lang = combine_results(\@ARGV, + $type, + \%{$Results{ $type }}, + \%Filters_by_Language ); + } next unless %Results; - my $end_time = time(); + my $end_time = get_time(); my @results = generate_report($VERSION, $end_time - $start_time, $type, \%{$Results{ $type }}, \%Scale_Factor); @@ -607,9 +799,18 @@ \%Not_Code_Extension , \%Not_Code_Filename , \%Scale_Factor , + \%EOL_Continuation_re , ); exit; } +if ($opt_show_os) { + if ($ON_WINDOWS) { + print "Windows\n"; + } else { + print "UNIX\n"; + } + exit; +} # 1}}} # Step 3: Create a list of files to consider. {{{1 # a) If inputs are binary archives, first cd to a temp @@ -627,10 +828,18 @@ #print "cwd main = [$cwd]\n"; my @extract_location = (); foreach my $bin_file (@ARGV) { - my $extract_dir = tempdir( CLEANUP => 1 ); # 1 = delete on exit - $TEMP_DIR{ $extract_dir } = 1 if $opt_sql; - print "mkdir $extract_dir\n" if $opt_v; - print "cd $extract_dir\n" if $opt_v; + my $extract_dir = undef; + if ($opt_sdir) { + ++$TEMP_OFF; + $extract_dir = "$opt_sdir/$TEMP_OFF"; + File::Path::rmtree($extract_dir) if is_dir($extract_dir); + File::Path::mkpath($extract_dir) unless is_dir($extract_dir); + } else { + $extract_dir = tempdir( CLEANUP => 1 ); # 1 = delete on exit + } + $TEMP_DIR{ $extract_dir } = 1 if $opt_sql or $opt_by_file; + print "mkdir $extract_dir\n" if $opt_v; + print "cd $extract_dir\n" if $opt_v; chdir $extract_dir; my $bin_file_full_path = ""; if (File::Spec->file_name_is_absolute( $bin_file )) { @@ -653,16 +862,25 @@ my $binary_archives_exist = 1; my $count_binary_archives = 0; my $previous_count = 0; + my $n_pass = 0; while ($binary_archives_exist) { @binary_archive = (); foreach my $dir (@extract_location) { find(\&archive_files, $dir); # populates global @binary_archive } foreach my $archive (@binary_archive) { - my $extract_dir = tempdir( CLEANUP => 1 ); # 1 = delete on exit - $TEMP_DIR{ $extract_dir } = 1 if $opt_sql; - print "mkdir $extract_dir\n" if $opt_v; - print "cd $extract_dir\n" if $opt_v; + my $extract_dir = undef; + if ($opt_sdir) { + ++$TEMP_OFF; + $extract_dir = "$opt_sdir/$TEMP_OFF"; + File::Path::rmtree($extract_dir) if is_dir($extract_dir); + File::Path::mkpath($extract_dir) unless is_dir($extract_dir); + } else { + $extract_dir = tempdir( CLEANUP => 1 ); # 1 = delete on exit + } + $TEMP_DIR{ $extract_dir } = 1 if $opt_sql or $opt_by_file; + print "mkdir $extract_dir\n" if $opt_v; + print "cd $extract_dir\n" if $opt_v; chdir $extract_dir; my $extract_cmd = uncompress_archive_cmd($archive); @@ -697,10 +915,18 @@ #print "full_path = [$full_path]\n"; my $extract_cmd = uncompress_archive_cmd($full_path); if ($extract_cmd) { - my $extract_dir = tempdir( CLEANUP => 1 ); # 1 = delete on exit - $TEMP_DIR{ $extract_dir } = 1 if $opt_sql; - print "mkdir $extract_dir\n" if $opt_v; - print "cd $extract_dir\n" if $opt_v; + my $extract_dir = undef; + if ($opt_sdir) { + ++$TEMP_OFF; + $extract_dir = "$opt_sdir/$TEMP_OFF"; + File::Path::rmtree($extract_dir) if is_dir($extract_dir); + File::Path::mkpath($extract_dir) unless is_dir($extract_dir); + } else { + $extract_dir = tempdir( CLEANUP => 1 ); # 1 = delete on exit + } + $TEMP_DIR{ $extract_dir } = 1 if $opt_sql or $opt_by_file; + print "mkdir $extract_dir\n" if $opt_v; + print "cd $extract_dir\n" if $opt_v; chdir $extract_dir; print $extract_cmd, "\n" if $opt_v; system $extract_cmd; @@ -713,6 +939,25 @@ } } @ARGV = @updated_ARGS; + + # make sure we're not counting any directory containing + # temporary installations of Regexp::Common, Algorithm::Diff + foreach my $d (sort keys %TEMP_INST) { + foreach my $a (@ARGV) { + next unless is_dir($a); + if ($opt_v > 2) { + printf "Comparing %s (location of %s) to input [%s]\n", + $d, $TEMP_INST{$d}, $a; + } + if ($a eq $d) { + die "File::Temp::tempdir chose directory ", + $d, " to install ", $TEMP_INST{$d}, " but this ", + "matches one of your input directories. Rerun ", + "with --sdir and supply a different temporary ", + "directory for ", $TEMP_INST{$d}, "\n"; + } + } + } } # 1}}} my @Errors = (); @@ -721,10 +966,15 @@ # problems reading the file) my @Lines_Out = (); if ($opt_diff) { -# Step 4: Separate code from non-code files. {{{1 -my @fh; +# Step 4: Separate code from non-code files. {{{1 +my @fh = (); my @files_for_set = (); # make file lists for each separate argument +if ($opt_exclude_list_file) { + process_exclude_list_file($opt_exclude_list_file, + \%Exclude_Dir, + \%Ignored); +} for (my $i = 0; $i < scalar @ARGV; $i++) { push @fh, make_file_list([ $ARGV[$i] ], \%Error_Codes, \@Errors, \%Ignored); @@ -777,6 +1027,41 @@ \@files_removed , # out \@file_pairs , # out ); + my %already_counted = (); # already_counted{ filename } = 1 + + if (!@file_pairs) { + # Special case where all files were either added or deleted. + # In this case, one of these arrays will be empty: + # @files_added, @files_removed + # so loop over both to cover both cases. + my $status = @files_added ? 'added' : 'removed'; + my $offset = @files_added ? 1 : 0 ; + foreach my $file (@files_added, @files_removed) { + next unless defined $Language{$fh[$F+$offset]}{$file}; + my $Lang = $Language{$fh[$F+$offset]}{$file}; + next if $Lang eq '(unknown)'; + my ($all_line_count, + $blank_count , + $comment_count , + ) = call_counter($file, $Lang, \@Errors); + $already_counted{$file} = 1; + my $code_count = $all_line_count-$blank_count-$comment_count; + if ($opt_by_file) { + $Delta_by_File{$file}{'code' }{$status} += $code_count ; + $Delta_by_File{$file}{'blank' }{$status} += $blank_count ; + $Delta_by_File{$file}{'comment'}{$status} += $comment_count; + $Delta_by_File{$file}{'lang' }{$status} = $Lang ; + $Delta_by_File{$file}{'nFiles' }{$status} += 1 ; + } + $Delta_by_Language{$Lang}{'code' }{$status} += $code_count ; + $Delta_by_Language{$Lang}{'blank' }{$status} += $blank_count ; + $Delta_by_Language{$Lang}{'comment'}{$status} += $comment_count; + $Delta_by_Language{$Lang}{'nFiles' }{$status} += 1 ; + } + } + #use Data::Dumper::Simple; + #use Data::Dumper; + #print Dumper(\@files_added, \@files_removed, \@file_pairs); my @alignment = (); # only used if --diff-alignment #print "after align_by_pairs:\n"; @@ -784,10 +1069,32 @@ push @alignment, sprintf "Files added: %d\n", scalar @files_added if $opt_diff_alignment; foreach my $f (@files_added) { + next if $already_counted{$f}; #printf "%10s -> %s\n", $f, $Language{$fh[$F+1]}{$f}; + # Don't proceed unless the file (both L and R versions) + # is in a known language. + next if $Language{$fh[$F+1]}{$f} eq "(unknown)"; + next if $Exclude_Language{$Language{$fh[$F+1]}{$f}}; push @alignment, sprintf " + %s ; %s\n", $f, $Language{$fh[$F+1]}{$f} if $opt_diff_alignment; ++$Delta_by_Language{ $Language{$fh[$F+1]}{$f} }{'nFiles'}{'added'}; + # Additionally, add contents of file $f to + # Delta_by_File{$f}{comment/blank/code}{'added'} + # Delta_by_Language{$lang}{comment/blank/code}{'added'} + my ($all_line_count, + $blank_count , + $comment_count , + ) = call_counter($f, $Language{$fh[$F+1]}{$f}, \@Errors); + $Delta_by_Language{ $Language{$fh[$F+1]}{$f} }{'comment'}{'added'} += + $comment_count; + $Delta_by_Language{ $Language{$fh[$F+1]}{$f} }{'blank'}{'added'} += + $blank_count; + $Delta_by_Language{ $Language{$fh[$F+1]}{$f} }{'code'}{'added'} += + $all_line_count - $blank_count - $comment_count; + $Delta_by_File{ $f }{'comment'}{'added'} = $comment_count; + $Delta_by_File{ $f }{'blank'}{'added'} = $blank_count; + $Delta_by_File{ $f }{'code'}{'added'} = + $all_line_count - $blank_count - $comment_count; } push @alignment, "\n"; @@ -795,16 +1102,43 @@ push @alignment, sprintf "Files removed: %d\n", scalar @files_removed if $opt_diff_alignment; foreach my $f (@files_removed) { + next if $already_counted{$f}; + # Don't proceed unless the file (both L and R versions) + # is in a known language. + next if $Language{$fh[$F ]}{$f} eq "(unknown)"; + next if $Exclude_Language{$Language{$fh[$F ]}{$f}}; ++$Delta_by_Language{ $Language{$fh[$F ]}{$f} }{'nFiles'}{'removed'}; push @alignment, sprintf " - %s ; %s\n", $f, $Language{$fh[$F]}{$f} if $opt_diff_alignment; #printf "%10s -> %s\n", $f, $Language{$fh[$F ]}{$f}; + # Additionally, add contents of file $f to + # Delta_by_File{$f}{comment/blank/code}{'removed'} + # Delta_by_Language{$lang}{comment/blank/code}{'removed'} + my ($all_line_count, + $blank_count , + $comment_count , + ) = call_counter($f, $Language{$fh[$F ]}{$f}, \@Errors); + $Delta_by_Language{ $Language{$fh[$F ]}{$f} }{'comment'}{'removed'} += + $comment_count; + $Delta_by_Language{ $Language{$fh[$F ]}{$f} }{'blank'}{'removed'} += + $blank_count; + $Delta_by_Language{ $Language{$fh[$F ]}{$f} }{'code'}{'removed'} += + $all_line_count - $blank_count - $comment_count; + $Delta_by_File{ $f }{'comment'}{'removed'} = $comment_count; + $Delta_by_File{ $f }{'blank'}{'removed'} = $blank_count; + $Delta_by_File{ $f }{'code'}{'removed'} = + $all_line_count - $blank_count - $comment_count; } push @alignment, "\n"; - push @alignment, sprintf "File pairs compared: %d\n", scalar @file_pairs + my $alignment_pairs_index = scalar @alignment; + my $n_file_pairs_compared = 0; + # Don't know ahead of time how many file pairs will be compared + # since duplicates are weeded out below. The answer is + # scalar @file_pairs only if there are no duplicates. + push @alignment, sprintf "File pairs compared: UPDATE_ME\n" if $opt_diff_alignment; -#print "Language=\n", Dumper(\%Language); + foreach my $pair (@file_pairs) { my $file_L = $pair->[0]; my $file_R = $pair->[1]; @@ -818,13 +1152,23 @@ # filter out excluded or unrecognized languages if ($Exclude_Language{$Lang_L} or $Exclude_Language{$Lang_R}) { - $Ignored{$file_L} = "--exclude_lang=$Lang_L}"; - $Ignored{$file_R} = "--exclude_lang=$Lang_R}"; + $Ignored{$file_L} = "--exclude-lang=$Lang_L}"; + $Ignored{$file_R} = "--exclude-lang=$Lang_R}"; next; } - if (!defined @{$Filters_by_Language{$Lang_L} } or - !defined @{$Filters_by_Language{$Lang_R} } - ) { + my $not_Filters_by_Language_Lang_LR = 0; + if ($PERL_516) { + if (!(@{$Filters_by_Language{$Lang_L} }) or + !(@{$Filters_by_Language{$Lang_R} })) { + $not_Filters_by_Language_Lang_LR = 1; + } + } else { + if (!defined(@{$Filters_by_Language{$Lang_L} }) or + !defined(@{$Filters_by_Language{$Lang_R} })) { + $not_Filters_by_Language_Lang_LR = 1; + } + } + if ($not_Filters_by_Language_Lang_LR) { if (($Lang_L eq "(unknown)") or ($Lang_R eq "(unknown)")) { $Ignored{$fh[$F ]}{$file_L} = "language unknown (#1)"; $Ignored{$fh[$F+1]}{$file_R} = "language unknown (#1)"; @@ -872,26 +1216,29 @@ } else { push @alignment, " != $str"; } + ++$n_file_pairs_compared; } # step 1: identify comments in both files #print "Diff blank removal L language= $Lang_L"; #print " scalar(lines_L)=", scalar @lines_L, "\n"; my @original_minus_blanks_L - = rm_blanks( \@lines_L, $Lang_L); + = rm_blanks( \@lines_L, $Lang_L, \%EOL_Continuation_re); #print "1: scalar(original_minus_blanks_L)=", scalar @original_minus_blanks_L, "\n"; @lines_L = @original_minus_blanks_L; #print "2: scalar(lines_L)=", scalar @lines_L, "\n"; @lines_L = add_newlines(\@lines_L); # compensate for rm_comments() - @lines_L = rm_comments( \@lines_L, $Lang_L, $file_L); + @lines_L = rm_comments( \@lines_L, $Lang_L, $file_L, + \%EOL_Continuation_re); #print "3: scalar(lines_L)=", scalar @lines_L, "\n"; #print "Diff blank removal R language= $Lang_R\n"; my @original_minus_blanks_R - = rm_blanks( \@lines_R, $Lang_R); + = rm_blanks( \@lines_R, $Lang_R, \%EOL_Continuation_re); @lines_R = @original_minus_blanks_R; @lines_R = add_newlines(\@lines_R); # taken away by rm_comments() - @lines_R = rm_comments( \@lines_R, $Lang_R, $file_R); + @lines_R = rm_comments( \@lines_R, $Lang_R, $file_R, + \%EOL_Continuation_re); my (@diff_LL, @diff_LR, ); array_diff( $file_L , # in @@ -951,6 +1298,13 @@ foreach (@comm_L) { s/\s+//g } foreach (@comm_R) { s/\s+//g } } + if ($opt_ignore_case) { + # change all text to lowercase in diffs + foreach (@code_L) { $_ = lc } + foreach (@code_R) { $_ = lc } + foreach (@comm_L) { $_ = lc } + foreach (@comm_R) { $_ = lc } + } # step 3: compute code diffs array_diff("$file_L v. $file_R" , # in \@code_L , # in @@ -989,6 +1343,8 @@ #die; here= need to save original line number in diff result for html display # step 5: compute difference in blank lines (kind of pointless) + next if $Lang_L eq '(unknown)' or + $Lang_R eq '(unknown)'; my ($all_line_count_L, $blank_count_L , $comment_count_L , @@ -1023,6 +1379,8 @@ $Results_by_File{$file_L}{'comment'} = $comment_count_L ; $Results_by_File{$file_L}{'lang' } = $Lang_L ; $Results_by_File{$file_L}{'nFiles' } = 1 ; + } else { + $Results_by_File{$file_L} = 1; # just keep track of counted files } $Results_by_Language{$Lang_L}{'nFiles'}++; @@ -1030,37 +1388,46 @@ $Results_by_Language{$Lang_L}{'blank'} += $blank_count_L ; $Results_by_Language{$Lang_L}{'comment'} += $comment_count_L; } - write_file($opt_diff_alignment, @alignment) if $opt_diff_alignment; + if ($opt_diff_alignment) { + $alignment[$alignment_pairs_index] =~ s/UPDATE_ME/$n_file_pairs_compared/; + write_file($opt_diff_alignment, @alignment); + } } #use Data::Dumper; -#print Dumper("Delta_by_Language:", \%Delta_by_Language); - +#print Dumper("Delta_by_Language:" , \%Delta_by_Language); +#print Dumper("Results_by_Language:", \%Results_by_Language); +#print Dumper("Delta_by_File:" , \%Delta_by_File); +#print Dumper("Results_by_File:" , \%Results_by_File); +#die; my @ignored_reasons = map { "$_: $Ignored{$_}" } sort keys %Ignored; write_file($opt_ignored, @ignored_reasons ) if $opt_ignored; -write_file($opt_counted, sort keys %Language) if $opt_counted; +write_file($opt_counted, sort keys %Results_by_File) if $opt_counted; # 1}}} -# Step 7: Assemble results. {{{1 +# Step 7: Assemble results. {{{1 # -my $end_time = time(); +my $end_time = get_time(); printf "%8d file%s ignored. \n", plural_form(scalar keys %Ignored) unless $opt_quiet; print_errors(\%Error_Codes, \@Errors) if @Errors; -exit unless %Results_by_Language; +if (!%Delta_by_Language) { + print "Nothing to count.\n"; + exit; +} if ($opt_by_file) { - @Lines_Out = diff_report($VERSION, time() - $start_time, + @Lines_Out = diff_report($VERSION, get_time() - $start_time, "by file", \%Delta_by_File, \%Scale_Factor); } else { - @Lines_Out = diff_report($VERSION, time() - $start_time, + @Lines_Out = diff_report($VERSION, get_time() - $start_time, "by language", \%Delta_by_Language, \%Scale_Factor); } # 1}}} } else { -# Step 4: Separate code from non-code files. {{{1 +# Step 4: Separate code from non-code files. {{{1 my $fh = 0; if ($opt_list_file) { my @list = read_list_file($opt_list_file); @@ -1071,29 +1438,9 @@ # File::Find's find() which in turn calls files() } if ($opt_exclude_list_file) { - # now reject a specific set of files and/or directories - my @reject_list = read_list_file($opt_exclude_list_file); - my @file_reject_list = (); - foreach my $F_or_D (@reject_list) { - if (is_dir($F_or_D)) { - $Exclude_Dir{$F_or_D} = 1; - } elsif (is_file($F_or_D)) { - push @file_reject_list, $F_or_D; - } - } - - # Normalize file names for better comparison. - my %normalized_input = normalize_file_names(@file_list); - my %normalized_reject = normalize_file_names(@file_reject_list); - my %normalized_exclude = normalize_file_names(keys %Exclude_Dir); - foreach my $F (keys %normalized_input) { - if ($normalized_reject{$F} or is_excluded($F, \%normalized_exclude)) { - my $orig_F = $normalized_input{$F}; - $Ignored{$orig_F} = "listed in exclusion file $opt_exclude_list_file"; - print "Ignoring $orig_F because it appears in $opt_exclude_list_file\n" - if $opt_v > 1; - } - } + process_exclude_list_file($opt_exclude_list_file, + \%Exclude_Dir, + \%Ignored); } if ($opt_skip_win_hidden and $ON_WINDOWS) { my @file_list_minus_hidded = (); @@ -1145,10 +1492,11 @@ unless (!$opt_progress_rate or ($nCounted % $opt_progress_rate)); next if $Ignored{$file}; if ($Exclude_Language{$Language{$file}}) { - $Ignored{$file} = "--exclude_lang=$Language{$file}"; + $Ignored{$file} = "--exclude-lang=$Language{$file}"; next; } - if (!defined @{$Filters_by_Language{$Language{$file}} }) { + my $Filters_by_Language_Language_file = !defined @{$Filters_by_Language{$Language{$file}} }; + if ($Filters_by_Language_Language_file) { if ($Language{$file} eq "(unknown)") { $Ignored{$file} = "language unknown (#1)"; } else { @@ -1168,6 +1516,8 @@ $Results_by_File{$file}{'comment'} = $comment_count ; $Results_by_File{$file}{'lang' } = $Language{$file}; $Results_by_File{$file}{'nFiles' } = 1; + } else { + $Results_by_File{$file} = 1; # just keep track of counted files } $Results_by_Language{$Language{$file}}{'nFiles'}++; @@ -1177,11 +1527,11 @@ } my @ignored_reasons = map { "$_: $Ignored{$_}" } sort keys %Ignored; write_file($opt_ignored, @ignored_reasons ) if $opt_ignored; -write_file($opt_counted, sort keys %Language) if $opt_counted; +write_file($opt_counted, sort keys %Results_by_File) if $opt_counted; # 1}}} -# Step 7: Assemble results. {{{1 +# Step 7: Assemble results. {{{1 # -my $end_time = time(); +my $end_time = get_time(); printf "%8d file%s ignored.\n", plural_form(scalar keys %Ignored) unless $opt_quiet; print_errors(\%Error_Codes, \@Errors) if @Errors; @@ -1212,6 +1562,37 @@ if ($opt_report_file) { write_file($opt_report_file, @Lines_Out); } else { print "\n", join("\n", @Lines_Out), "\n"; } +sub process_exclude_list_file { # {{{1 + my ($list_file , # in + $rh_exclude_dir , # out + $rh_ignored , # out + ) = @_; + print "-> process_exclude_list_file($list_file)\n" if $opt_v > 2; + # reject a specific set of files and/or directories + my @reject_list = read_list_file($list_file); + my @file_reject_list = (); + foreach my $F_or_D (@reject_list) { + if (is_dir($F_or_D)) { + $rh_exclude_dir->{$F_or_D} = 1; + } elsif (is_file($F_or_D)) { + push @file_reject_list, $F_or_D; + } + } + + # Normalize file names for better comparison. + my %normalized_input = normalize_file_names(@file_list); + my %normalized_reject = normalize_file_names(@file_reject_list); + my %normalized_exclude = normalize_file_names(keys %{$rh_exclude_dir}); + foreach my $F (keys %normalized_input) { + if ($normalized_reject{$F} or is_excluded($F, \%normalized_exclude)) { + my $orig_F = $normalized_input{$F}; + $rh_ignored->{$orig_F} = "listed in exclusion file $opt_exclude_list_file"; + print "Ignoring $orig_F because it appears in $opt_exclude_list_file\n" + if $opt_v > 1; + } + } + print "<- process_exclude_list_file\n" if $opt_v > 2; +} # 1}}} sub combine_results { # {{{1 # returns 1 if the inputs are categorized by language # 0 if no identifiable language was found @@ -1221,6 +1602,7 @@ $rhaa_Filters_by_Language , # in ) = @_; + print "-> combine_results(report_type=$report_type)\n" if $opt_v > 2; my $found_language = 0; foreach my $file (@{$ra_report_files}) { @@ -1245,7 +1627,11 @@ )? $}x) { if ($report_type eq "by language") { - next unless defined @{$rhaa_Filters_by_Language->{$1}}; + if ($PERL_516) { + next unless @{$rhaa_Filters_by_Language->{$1}}; + } else { + next unless defined @{$rhaa_Filters_by_Language->{$1}}; + } # above test necessary to avoid trying to sum reports # of reports (which have no language breakdown). $found_language = 1; @@ -1274,7 +1660,7 @@ )? $}x) { if ($report_type eq "by language") { - next unless defined %{$rhaa_Filters_by_Language->{$1}}; + next unless %{$rhaa_Filters_by_Language->{$1}}; # above test necessary to avoid trying to sum reports # of reports (which have no language breakdown). $found_language = 1; @@ -1293,13 +1679,20 @@ } } } + print "<- combine_results\n" if $opt_v > 2; return $found_language; - } # 1}}} sub diff_report { # {{{1 # returns an array of lines containing the results + print "-> diff_report\n" if $opt_v > 2; - return diff_xml_report(@_) if $opt_xml; + if ($opt_xml or $opt_yaml) { + print "<- diff_report\n" if $opt_v > 2; + return diff_xml_yaml_report(@_) + } elsif ($opt_csv) { + print "<- diff_report\n" if $opt_v > 2; + return diff_csv_report(@_) + } my ($version , # in $elapsed_sec, # in @@ -1308,6 +1701,7 @@ $rh_scale , # in ) = @_; +#use Data::Dumper; #print "diff_report: ", Dumper($rhhh_count), "\n"; my @results = (); @@ -1379,10 +1773,10 @@ $first_column = "Report File"; } - my $header_line = sprintf "%s v %4.2f", $URL, $version; -my $sum_files=1; -my $sum_lines=1; - $header_line .= sprintf(" T=%.1f s (%.1f files/s, %.1f lines/s)", + my $header_line = sprintf "%s v %s", $URL, $version; + my $sum_files = 1; + my $sum_lines = 1; + $header_line .= sprintf(" T=%.2f s (%.1f files/s, %.1f lines/s)", $elapsed_sec , $sum_files/$elapsed_sec, $sum_lines/$elapsed_sec) unless $opt_sum_reports; @@ -1408,24 +1802,27 @@ "blank" , "comment" , "code"; + if ($Style eq "txt") { push @results, $data_line; push @results, $hyphen_line; - } elsif ($Style eq "xml") { - if ($BY_FILE) { - push @results, ""; - } else { - push @results, ""; - } - } # here= + } +####foreach my $lang_or_file (keys %{$rhhh_count}) { +#### $rhhh_count->{$lang_or_file}{'code'} = 0 unless +#### defined $rhhh_count->{$lang_or_file}{'code'}; +####} foreach my $lang_or_file (sort { $rhhh_count->{$b}{'code'} <=> $rhhh_count->{$a}{'code'} } keys %{$rhhh_count}) { - push @results, "$lang_or_file"; + if ($BY_FILE) { + push @results, rm_leading_tempdir($lang_or_file, \%TEMP_DIR); + } else { + push @results, $lang_or_file; + } foreach my $S (qw(same modified added removed)) { my $indent = $spacing_1 - 2; my $line .= sprintf " %-${indent}s", $S; @@ -1458,10 +1855,72 @@ push @results, $line; } push @results, "-" x 79; + write_xsl_file() if $opt_xsl and $opt_xsl eq $CLOC_XSL; + print "<- diff_report\n" if $opt_v > 2; return @results; } # 1}}} -sub diff_xml_report { # {{{1 +sub xml_or_yaml_header { # {{{1 + my ($URL, $version, $elapsed_sec, $sum_files, $sum_lines, $by_file) = @_; + print "-> xml_or_yaml_header\n" if $opt_v > 2; + my $header = ""; + my $file_rate = $sum_files/$elapsed_sec; + my $line_rate = $sum_lines/$elapsed_sec; + my $type = ""; + $type = "diff_" if $opt_diff; + my $report_file = ""; + if ($opt_report_file) { + if ($opt_sum_reports) { + if ($by_file) { + $report_file = " $opt_report_file.file" + } else { + $report_file = " $opt_report_file.lang" + } + } else { + $report_file = " $opt_report_file" + } + } + if ($opt_xml) { + $header = ""; + $header .= "\n" if $opt_xsl; + $header .= "<${type}results> +
+ $URL + $version + $elapsed_sec + $sum_files + $sum_lines + $file_rate + $line_rate"; + $header .= "\n$report_file" + if $opt_report_file; + $header .= "\n
"; + } elsif ($opt_yaml) { + $header = "---\n# $URL +header : + cloc_url : http://cloc.sourceforge.net + cloc_version : $version + elapsed_seconds : $elapsed_sec + n_files : $sum_files + n_lines : $sum_lines + files_per_second : $file_rate + lines_per_second : $line_rate"; + if ($opt_report_file) { + if ($opt_sum_reports) { + if ($by_file) { + $header .= "\n report_file : $opt_report_file.file" + } else { + $header .= "\n report_file : $opt_report_file.lang" + } + } else { + $header .= "\n report_file : $opt_report_file"; + } + } + } + print "<- xml_or_yaml_header\n" if $opt_v > 2; + return $header; +} # 1}}} +sub diff_xml_yaml_report { # {{{1 # returns an array of lines containing the results my ($version , # in $elapsed_sec, # in @@ -1469,6 +1928,7 @@ $rhhh_count , # in count{TYPE}{nFiles|code|blank|comment}{a|m|r|s} $rh_scale , # in ) = @_; + print "-> diff_xml_yaml_report\n" if $opt_v > 2; #print "diff_report: ", Dumper($rhhh_count), "\n"; my @results = (); @@ -1476,20 +1936,25 @@ my $languages = (); my %sum = (); # sum{nFiles|blank|comment|code}{same|modified|added|removed} + my $sum_files = 0; + my $sum_lines = 0; foreach my $language (keys %{$rhhh_count}) { foreach my $V (qw(nFiles blank comment code)) { foreach my $S (qw(added same modified removed)) { $rhhh_count->{$language}{$V}{$S} = 0 unless defined $rhhh_count->{$language}{$V}{$S}; $sum{$V}{$S} += $rhhh_count->{$language}{$V}{$S}; + if ($V eq "nFiles") { + $sum_files += $rhhh_count->{$language}{$V}{$S}; + } else { + $sum_lines += $rhhh_count->{$language}{$V}{$S}; + } } } } $elapsed_sec = 0.5 unless $elapsed_sec; - my $Style = "xml"; - - my $data_line = ""; + my $data_line = ""; my $BY_LANGUAGE = 0; my $BY_FILE = 0; if ($report_type eq "by language") { @@ -1498,54 +1963,171 @@ $BY_FILE = 1; } - my $header_line = sprintf "%s v %4.2f", $URL, $version; - -my $sum_files=1; -my $sum_lines=1; - $header_line .= sprintf(" T=%.1f s (%.1f files/s, %.1f lines/s)", - $elapsed_sec , - $sum_files/$elapsed_sec, - $sum_lines/$elapsed_sec); - push @results, -" - - -
$header_line
"; + if (!$ALREADY_SHOWED_HEADER) { + push @results, + xml_or_yaml_header($URL, $version, $elapsed_sec, + $sum_files, $sum_lines, $BY_FILE); + $ALREADY_SHOWED_HEADER = 1; + } foreach my $S (qw(same modified added removed)) { - push @results, " <$S>"; + if ($opt_xml) { + push @results, " <$S>"; + } elsif ($opt_yaml) { + push @results, "$S :"; + } +########foreach my $lang_or_file (keys %{$rhhh_count}) { +######## $rhhh_count->{$lang_or_file}{'code'} = 0 unless +######## defined $rhhh_count->{$lang_or_file}{'code'}; +########} foreach my $lang_or_file (sort { $rhhh_count->{$b}{'code'} <=> $rhhh_count->{$a}{'code'} } keys %{$rhhh_count}) { my $L = ""; - if ($BY_FILE) { - $L .= sprintf " {$lang_or_file}{'nFiles'}{$S}; - } - foreach my $T (qw(blank comment code)) { - $L .= sprintf "%s=\"%d\" ", - $T, $rhhh_count->{$lang_or_file}{$T}{$S}; + if ($opt_xml) { + if ($BY_FILE) { + $L .= sprintf " {$lang_or_file}{'nFiles'}{$S}; + } + foreach my $T (qw(blank comment code)) { + $L .= sprintf "%s=\"%d\" ", + $T, $rhhh_count->{$lang_or_file}{$T}{$S}; + } + push @results, $L . "/>"; + } elsif ($opt_yaml) { + if ($BY_FILE) { + push @results, sprintf " - file : %s", + rm_leading_tempdir($lang_or_file, \%TEMP_DIR); + push @results, sprintf " files_count : 1", + } else { + push @results, sprintf " - language : %s", $lang_or_file; + push @results, sprintf " files_count : %d", + $rhhh_count->{$lang_or_file}{'nFiles'}{$S}; + } + foreach my $T (qw(blank comment code)) { + push @results, sprintf " %s : %d", + $T, $rhhh_count->{$lang_or_file}{$T}{$S}; + } + } + } + + if ($opt_xml) { + my $L = sprintf " "; + push @results, " "; + } elsif ($opt_yaml) { + push @results, sprintf "%s_total :\n sum_files : %d", + $S, $sum{'nFiles'}{$S}; + foreach my $V (qw(blank comment code)) { + push @results, sprintf " %s : %d", $V, $sum{$V}{$S}; + } } + } + + if ($opt_xml) { + push @results, "
"; + } + write_xsl_file() if $opt_xsl and $opt_xsl eq $CLOC_XSL; + print "<- diff_xml_yaml_report\n" if $opt_v > 2; + return @results; +} # 1}}} +sub diff_csv_report { # {{{1 + # returns an array of lines containing the results + my ($version , # in + $elapsed_sec, # in + $report_type, # in "by language" | "by report file" | "by file" + $rhhh_count , # in count{TYPE}{nFiles|code|blank|comment}{a|m|r|s} + $rh_scale , # in unused + ) = @_; + print "-> diff_csv_report\n" if $opt_v > 2; + +#use Data::Dumper; +#print "diff_csv_report: ", Dumper($rhhh_count), "\n"; +#die; + my @results = (); + my $languages = (); + + my $data_line = ""; + my $BY_LANGUAGE = 0; + my $BY_FILE = 0; + if ($report_type eq "by language") { + $BY_LANGUAGE = 1; + } elsif ($report_type eq "by file") { + $BY_FILE = 1; + } + my $DELIM = ","; + $DELIM = $opt_csv_delimiter if defined $opt_csv_delimiter; + + $elapsed_sec = 0.5 unless $elapsed_sec; - my $L = sprintf " {$lang_or_file}{'code'}{'added'} = 0 unless + defined $rhhh_count->{$lang_or_file}{'code'}; + } + foreach my $lang_or_file (sort { + $rhhh_count->{$b}{'code'} <=> + $rhhh_count->{$a}{'code'} + } + keys %{$rhhh_count}) { + if ($BY_FILE) { + $line = rm_leading_tempdir($lang_or_file, \%TEMP_DIR) . "$DELIM "; + } else { + $line = $lang_or_file . "${DELIM} "; + } + foreach my $item (qw(nFiles blank comment code)) { + next if $BY_FILE and $item eq 'nFiles'; + foreach my $symbol (qw(same modified added removed)) { + if (defined $rhhh_count->{$lang_or_file}{$item}{$symbol}) { + $line .= "$rhhh_count->{$lang_or_file}{$item}{$symbol}${DELIM} "; + } else { + $line .= "0${DELIM} "; + } + } } - push @results, $L . "/>"; - push @results, " "; + push @results, $line; } - push @results, ""; + print "<- diff_csv_report\n" if $opt_v > 2; return @results; } # 1}}} +sub rm_leading_tempdir { # {{{1 + my ($in_file, $rh_temp_dirs, ) = @_; + my $clean_filename = $in_file; + foreach my $temp_d (keys %{$rh_temp_dirs}) { + if ($ON_WINDOWS) { + # \ -> / necessary to allow the next if test's + # m{} to work in the presence of spaces in file names + $temp_d =~ s{\\}{/}g; + $clean_filename =~ s{\\}{/}g; + } + if ($clean_filename =~ m{^$temp_d/}) { + $clean_filename =~ s{^$temp_d/}{}; + last; + } + } + $clean_filename =~ s{/}{\\}g if $ON_WINDOWS; # then go back from / to \ + return $clean_filename; +} # 1}}} sub generate_sql { # {{{1 my ($elapsed_sec, # in $rhh_count , # in count{TYPE}{lang|code|blank|comment|scaled} @@ -1594,19 +2176,8 @@ # archive file [.tar.gz, etc]), strip the temporary # directory name which was used to expand the archive # from the file name. - foreach my $temp_d (keys %TEMP_DIR) { - if ($ON_WINDOWS) { - # \ -> / necessary to allow the next if test's - # m{} to work in the presence of spaces in file names - $temp_d =~ s{\\}{/}g; - $clean_filename =~ s{\\}{/}g; - } - if ($clean_filename =~ m{^$temp_d/}) { - $clean_filename =~ s{^$temp_d/}{}; - last; - } - } - $clean_filename =~ s{/}{\\}g if $ON_WINDOWS; # then go back from / to \ + + $clean_filename = rm_leading_tempdir($clean_filename, \%TEMP_DIR); printf $fh "insert into t values('%s', '%s', '%s', %d, %d, %d, %f);\n", $opt_sql_project , $language , @@ -1641,13 +2212,17 @@ my ($header_line, $hyphen_line, $BY_FILE ,) = @_; + print "-> output_header\n" if $opt_v > 2; my @R = (); if ($opt_xml) { - push @R, ""; - push @R, '' if $opt_xsl; - push @R, ""; - push @R, "
$header_line
"; + if (!$ALREADY_SHOWED_XML_SECTION) { + push @R, ""; + push @R, '' if $opt_xsl; + push @R, ""; + push @R, "
$header_line
"; + $ALREADY_SHOWED_XML_SECTION = 1; + } if ($BY_FILE) { push @R, ""; } else { @@ -1668,6 +2243,7 @@ } push @R, $hyphen_line; } + print "<- output_header\n" if $opt_v > 2; return @R; } # 1}}} sub generate_report { # {{{1 @@ -1679,6 +2255,10 @@ $rh_scale , # in ) = @_; + print "-> generate_report\n" if $opt_v > 2; + my $DELIM = ","; + $DELIM = $opt_csv_delimiter if defined $opt_csv_delimiter; + my @results = (); my $languages = (); @@ -1747,16 +2327,36 @@ } elsif ($report_type eq "by file") { $first_column = "File"; $BY_FILE = 1; + } elsif ($report_type eq "by report file") { + $first_column = "File"; + $BY_FILE = 1; } else { $first_column = "Report File"; } - my $header_line = sprintf "%s v %4.2f", $URL, $version; - $header_line .= sprintf(" T=%.1f s (%.1f files/s, %.1f lines/s)", + my $header_line = sprintf "%s v %s", $URL, $version; + $header_line .= sprintf(" T=%.2f s (%.1f files/s, %.1f lines/s)", $elapsed_sec , $sum_files/$elapsed_sec, $sum_lines/$elapsed_sec) unless $opt_sum_reports; - push @results, output_header($header_line, $hyphen_line, $BY_FILE); + if ($opt_xml or $opt_yaml) { + if (!$ALREADY_SHOWED_HEADER) { + push @results, xml_or_yaml_header($URL, $version, $elapsed_sec, + $sum_files, $sum_lines, $BY_FILE); + $ALREADY_SHOWED_HEADER = 1 unless $opt_sum_reports; + # --sum-reports yields two xml or yaml files, one by + # language and one by report file, each of which needs a header + } + if ($opt_xml) { + if ($BY_FILE) { + push @results, ""; + } else { + push @results, ""; + } + } + } else { + push @results, output_header($header_line, $hyphen_line, $BY_FILE); + } if ($Style eq "txt") { # column headers @@ -1785,22 +2385,27 @@ if ($opt_csv) { my $header2; if ($BY_FILE) { - $header2 = "language,filename"; + $header2 = "language${DELIM}filename"; } else { - $header2 = "files,language"; + $header2 = "files${DELIM}language"; } - $header2 .= ",blank,comment,code"; - $header2 .= ",scale,3rd gen. equiv" if $opt_3; - $header2 .= ',"' . $header_line . '"'; + $header2 .= "${DELIM}blank${DELIM}comment${DELIM}code"; + $header2 .= "${DELIM}scale${DELIM}3rd gen. equiv" if $opt_3; + $header2 .= ${DELIM} . '"' . $header_line . '"'; push @results, $header2; } my $sum_scaled = 0; +####foreach my $lang_or_file (keys %{$rhh_count}) { +#### $rhh_count->{$lang_or_file}{'code'} = 0 unless +#### defined $rhh_count->{$lang_or_file}{'code'}; +####} foreach my $lang_or_file (sort { $rhh_count->{$b}{'code'} <=> $rhh_count->{$a}{'code'} } keys %{$rhh_count}) { + next if $lang_or_file eq "by report file"; my ($factor, $scaled); if ($BY_LANGUAGE or $BY_FILE) { $factor = 1; @@ -1811,7 +2416,11 @@ warn "No scale factor for $lang_or_file; using 1.00"; } } else { # by individual code file - $factor = $rh_scale->{$rhh_count->{$lang_or_file}{'lang'}}; + if ($report_type ne "by report file") { + next unless defined $rhh_count->{$lang_or_file}{'lang'}; + next unless defined $rh_scale->{$rhh_count->{$lang_or_file}{'lang'}}; + $factor = $rh_scale->{$rhh_count->{$lang_or_file}{'lang'}}; + } } $scaled = $factor*$rhh_count->{$lang_or_file}{'code'}; } else { @@ -1831,7 +2440,8 @@ } if ($BY_FILE) { - $data_line = sprintf $Format{'1'}{$Style}, $lang_or_file; + my $clean_filename = rm_leading_tempdir($lang_or_file, \%TEMP_DIR); + $data_line = sprintf $Format{'1'}{$Style}, $clean_filename; } else { $data_line = sprintf $Format{'2'}{$Style}, $lang_or_file; } @@ -1855,9 +2465,9 @@ $data_line.=' language="' . $lang . '" '; } if ($BY_FILE) { - push @results, ""; + push @results, " "; } else { - push @results, ""; + push @results, " "; } } elsif ($opt_yaml) { push @results,$lang_or_file . ":"; @@ -1874,23 +2484,27 @@ } } elsif ($opt_csv) { my $extra_3 = ""; - $extra_3 = ",$factor,$scaled" if $opt_3; - my $str; - if ($BY_FILE) { - $str = $rhh_count->{$lang_or_file}{'lang'} . ","; + $extra_3 = "${DELIM}$factor${DELIM}$scaled" if $opt_3; + my $first_column = undef; + my $clean_name = $lang_or_file; + if ($BY_FILE) { + $first_column = $rhh_count->{$lang_or_file}{'lang'}; + $clean_name = rm_leading_tempdir($lang_or_file, \%TEMP_DIR); } else { - $str = $rhh_count->{$lang_or_file}{'nFiles'} . ","; - } - $str .= $lang_or_file . "," . - $rhh_count->{$lang_or_file}{'blank'} . "," . - $rhh_count->{$lang_or_file}{'comment'}. "," . - $rhh_count->{$lang_or_file}{'code'} . - $extra_3; + $first_column = $rhh_count->{$lang_or_file}{'nFiles'}; + } + my $str = $first_column . ${DELIM} . + $clean_name . ${DELIM} . + $rhh_count->{$lang_or_file}{'blank'} . ${DELIM} . + $rhh_count->{$lang_or_file}{'comment'}. ${DELIM} . + $rhh_count->{$lang_or_file}{'code'} . + $extra_3; push @results, $str; } else { push @results, $data_line; } } + my $avg_scale = 1; # weighted average of scale factors $avg_scale = sprintf("%.2f", $sum_scaled / $sum_code) if $sum_code and $opt_3; @@ -1907,18 +2521,22 @@ $data_line .= sprintf $Format{'5'}{$Style}, $avg_scale , $sum_scaled if $opt_3; - push @results, ""; - + push @results, " "; + if ($BY_FILE) { push @results, ""; } else { foreach my $language (keys %{$languages}) { - push @results, ''; + push @results, ' '; } push @results, "
"; } - - push @results, ""; + + if (!$opt_by_file_by_lang or $ALREADY_SHOWED_XML_SECTION) { + push @results, ""; + } else { + $ALREADY_SHOWED_XML_SECTION = 1; + } } elsif ($opt_yaml) { push @results, "SUM:"; push @results, " blank: " . $sum_blank ; @@ -1932,7 +2550,7 @@ } elsif ($opt_csv) { # do nothing } else { - + if ($BY_FILE) { $data_line = sprintf "%-${spacing_0}s ", "SUM:" ; } else { @@ -1946,11 +2564,12 @@ $data_line .= sprintf $Format{'5'}{$Style}, $avg_scale , $sum_scaled if $opt_3; - push @results, $hyphen_line if $sum_files > 1; - push @results, $data_line if $sum_files > 1; + push @results, $hyphen_line if $sum_files > 1 or $opt_sum_one; + push @results, $data_line if $sum_files > 1 or $opt_sum_one; push @results, $hyphen_line; } write_xsl_file() if $opt_xsl and $opt_xsl eq $CLOC_XSL; + print "<- generate_report\n" if $opt_v > 2; return @results; } # 1}}} sub print_errors { # {{{1 @@ -1958,6 +2577,7 @@ $raa_errors , # in ) = @_; + print "-> print_errors\n" if $opt_v > 2; my %error_string = reverse(%{$rh_Error_Codes}); my $nErrors = scalar @{$raa_errors}; warn sprintf "\n%d error%s:\n", plural_form(scalar @Errors); @@ -1966,6 +2586,7 @@ $error_string{ $raa_errors->[$i][0] }, $raa_errors->[$i][1] ; } + print "<- print_errors\n" if $opt_v > 2; } # 1}}} sub write_lang_def { # {{{1 @@ -1977,13 +2598,17 @@ $rh_Not_Code_Extension , # in $rh_Not_Code_Filename , # in $rh_Scale_Factor , # in + $rh_EOL_Continuation_re , # in ) = @_; + print "-> write_lang_def($file)\n" if $opt_v > 2; my $OUT = new IO::File $file, "w"; die "Unable to write to $file\n" unless defined $OUT; foreach my $language (sort keys %{$rhaa_Filters_by_Language}) { - next if $language eq "MATLAB/Objective C/MUMPS"; + next if $language eq "MATLAB/Objective C/MUMPS" or + $language eq "PHP/Pascal" or + $language eq "Lisp/OpenCL"; printf $OUT "%s\n", $language; foreach my $filter (@{$rhaa_Filters_by_Language->{$language}}) { printf $OUT " filter %s", $filter->[0]; @@ -2006,9 +2631,14 @@ } } printf $OUT " 3rd_gen_scale %.2f\n", $rh_Scale_Factor->{$language}; + if (defined $rh_EOL_Continuation_re->{$language}) { + printf $OUT " end_of_line_continuation %s\n", + $rh_EOL_Continuation_re->{$language}; + } } $OUT->close; + print "<- write_lang_def\n" if $opt_v > 2; } # 1}}} sub read_lang_def { # {{{1 my ($file , @@ -2019,8 +2649,12 @@ $rh_Not_Code_Extension , # out $rh_Not_Code_Filename , # out $rh_Scale_Factor , # out + $rh_EOL_Continuation_re , # out + $rh_EOL_abc, ) = @_; + + print "-> read_lang_def($file)\n" if $opt_v > 2; my $IN = new IO::File $file, "r"; die "Unable to read $file.\n" unless defined $IN; @@ -2060,32 +2694,110 @@ } elsif (/^ 3rd_gen_scale\s+(\S+)\s*$/) { $rh_Scale_Factor->{$language} = $1; + } elsif (/^ end_of_line_continuation\s+(\S+)\s*$/) { + $rh_EOL_Continuation_re->{$language} = $1; + } else { die "Unexpected data line $. of $file:\n$_\n"; } } $IN->close; + print "<- read_lang_def\n" if $opt_v > 2; } # 1}}} -sub print_extension_info { # {{{1 - my ($extension,) = @_; - if ($extension) { # show information on this extension - foreach my $ext (sort {lc $a cmp lc $b } keys %Language_by_Extension) { - # Language_by_Extension{f} = 'Fortran 77' - printf "%-12s -> %s\n", $ext, $Language_by_Extension{$ext} - if $ext =~ m{$extension}i; - } - } else { # show information on all extensions - foreach my $ext (sort {lc $a cmp lc $b } keys %Language_by_Extension) { - # Language_by_Extension{f} = 'Fortran 77' - printf "%-12s -> %s\n", $ext, $Language_by_Extension{$ext}; - } - } -} # 1}}} -sub print_language_info { # {{{1 - my ($language,) = @_; - my %extensions = (); # the subset matched by the given $language value - if ($language) { # show information on this language +sub merge_lang_def { # {{{1 + my ($file , + $rh_Language_by_Extension , # in/out + $rh_Language_by_Script , # in/out + $rh_Language_by_File , # in/out + $rhaa_Filters_by_Language , # in/out + $rh_Not_Code_Extension , # in/out + $rh_Not_Code_Filename , # in/out + $rh_Scale_Factor , # in/out + $rh_EOL_Continuation_re , # in/out + $rh_EOL_abc, + ) = @_; + + + print "-> merge_lang_def($file)\n" if $opt_v > 2; + my $IN = new IO::File $file, "r"; + die "Unable to read $file.\n" unless defined $IN; + + my $language = ""; + my $already_know_it = undef; + while (<$IN>) { + next if /^\s*#/ or /^\s*$/; + + if (/^(\w+.*?)\s*$/) { + $language = $1; + $already_know_it = defined $rh_Scale_Factor->{$language}; + next; + } + die "Missing computer language name, line $. of $file\n" + unless $language; + + if (/^ filter\s+(\w+)\s*$/) { + next if $already_know_it; + push @{$rhaa_Filters_by_Language->{$language}}, [ $1 ] + + } elsif (/^ filter\s+(\w+)\s+(.*?)\s*$/) { + next if $already_know_it; + push @{$rhaa_Filters_by_Language->{$language}}, [ $1 , $2 ] + + } elsif (/^ extension\s+(\S+)\s*$/) { + next if $already_know_it; + if (defined $rh_Language_by_Extension->{$1}) { + die "File extension collision: $1 ", + "maps to languages '$rh_Language_by_Extension->{$1}' ", + "and '$language'\n" , + "Edit $file and remove $1 from one of these two ", + "language definitions.\n"; + } + $rh_Language_by_Extension->{$1} = $language; + + } elsif (/^ filename\s+(\S+)\s*$/) { + next if $already_know_it; + $rh_Language_by_File->{$1} = $language; + + } elsif (/^ script_exe\s+(\S+)\s*$/) { + next if $already_know_it; + $rh_Language_by_Script->{$1} = $language; + + } elsif (/^ 3rd_gen_scale\s+(\S+)\s*$/) { + next if $already_know_it; + $rh_Scale_Factor->{$language} = $1; + + } elsif (/^ end_of_line_continuation\s+(\S+)\s*$/) { + next if $already_know_it; + $rh_EOL_Continuation_re->{$language} = $1; + + } else { + die "Unexpected data line $. of $file:\n$_\n"; + } + + } + $IN->close; + print "<- merge_lang_def\n" if $opt_v > 2; +} # 1}}} +sub print_extension_info { # {{{1 + my ($extension,) = @_; + if ($extension) { # show information on this extension + foreach my $ext (sort {lc $a cmp lc $b } keys %Language_by_Extension) { + # Language_by_Extension{f} = 'Fortran 77' + printf "%-12s -> %s\n", $ext, $Language_by_Extension{$ext} + if $ext =~ m{$extension}i; + } + } else { # show information on all extensions + foreach my $ext (sort {lc $a cmp lc $b } keys %Language_by_Extension) { + # Language_by_Extension{f} = 'Fortran 77' + printf "%-12s -> %s\n", $ext, $Language_by_Extension{$ext}; + } + } +} # 1}}} +sub print_language_info { # {{{1 + my ($language,) = @_; + my %extensions = (); # the subset matched by the given $language value + if ($language) { # show information on this language foreach my $ext (sort {lc $a cmp lc $b } keys %Language_by_Extension) { # Language_by_Extension{f} = 'Fortran 77' push @{$extensions{$Language_by_Extension{$ext}} }, $ext @@ -2105,6 +2817,13 @@ push @{$extensions{'MATLAB'}} , "m"; push @{$extensions{'MUMPS'}} , "m"; delete $extensions{'MATLAB/Objective C/MUMPS'}; + } elsif ($language =~ /^(Lisp|OpenCL)$/i) { + push @{$extensions{'Lisp'}} , "cl"; + push @{$extensions{'OpenCL'}}, "cl"; + delete $extensions{'Lisp/OpenCL'}; + } elsif ($language =~ /^(Ant)$/i) { + push @{$extensions{'Ant'}} , "build.xml"; + delete $extensions{'Ant/XML'}; } if (%extensions) { @@ -2173,7 +2892,8 @@ } foreach my $dir (@dir_list) { #print "make_file_list dir=$dir\n"; - find(\&files, $dir); # populates global variable @file_list + # populates global variable @file_list + find({wanted => \&files, follow => $opt_follow_links }, $dir); } $nFiles_Found = scalar @file_list; printf "%8d text file%s.\n", plural_form($nFiles_Found) unless $opt_quiet; @@ -2262,7 +2982,14 @@ next; } else { #print "equally sized files: ",join(", ", @{$files_by_size{$bytes}}), "\n"; - foreach my $F (different_files(\@{$files_by_size{$bytes}}, + # Files in the list @{$files_by_size{$bytes} all are + # $bytes long. Sort the list by file basename. + my @sorted_bn = (); + my %BN = map { basename($_) => $_ } @{$files_by_size{$bytes}}; + foreach my $F (sort keys %BN) { + push @sorted_bn, $BN{$F}; + } + foreach my $F (different_files(\@sorted_bn , $rh_Err , $raa_errors , $rh_ignored ) ) { @@ -2273,7 +3000,8 @@ print "<- remove_duplicate_files\n" if $opt_v > 2; } # 1}}} sub files { # {{{1 - # invoked by File::Find's find() Populates global variable @file_list + # invoked by File::Find's find() Populates global variables, + # @file_list, %Ignored if ($opt_exclude_dir or $opt_exclude_list_file) { my $return = 0; foreach my $skip_dir (keys %Exclude_Dir) { @@ -2281,22 +3009,34 @@ # newer versions (1.13) no longer do; have to correct for this my $dir = $File::Find::dir; $dir = "./$dir" unless $dir =~ m{^/}; - if ($dir =~ m{/$skip_dir(/|$)} ) { - $Ignored{$File::Find::name} = "--exclude_dir=$skip_dir"; + if ($dir =~ m{/\Q$skip_dir\E(/|$)} ) { + $Ignored{$File::Find::name} = "--exclude-dir=$skip_dir"; $return = 1; last; } } return if $return; } + my $Dir = cwd(); # not $File::Find::dir which just gives relative path if ($opt_match_f ) { return unless /$opt_match_f/; } if ($opt_not_match_f) { return if /$opt_not_match_f/; } + if ($opt_match_d ) { return unless $Dir =~ m{$opt_match_d} } + if ($opt_not_match_d) { return if $Dir =~ m{$opt_not_match_d} } my $nBytes = -s $_ ; - if (!$nBytes and $opt_v > 5) { - printf "files(%s) zero size\n", $File::Find::name; + if (!$nBytes) { + $Ignored{$File::Find::name} = 'zero sized file'; + printf "files(%s) zero size\n", $File::Find::name if $opt_v > 5; } return unless $nBytes ; # attempting other tests w/pipe or socket will hang + if ($nBytes > $opt_max_file_size*1024**2) { + $Ignored{$File::Find::name} = "file size of " . + $nBytes/1024**2 . " MB exceeds max file size of " . + "$opt_max_file_size MB"; + printf "file(%s) exceeds $opt_max_file_size MB\n", + $File::Find::name if $opt_v > 5; + return; + } my $is_dir = is_dir($_); my $is_bin = -B $_ ; printf "files(%s) size=%d is_dir=%d -B=%d\n", @@ -2363,17 +3103,40 @@ print "-> classify_file($full_file)\n" if $opt_v > 2; my $language = "(unknown)"; + if (basename($full_file) eq "-" && defined $opt_stdin_name) { + $full_file = $opt_stdin_name; + } + my $look_at_first_line = 0; my $file = basename $full_file; + if ($opt_autoconf and $file =~ /\.in$/) { + $file =~ s/\.in$//; + } return $language if $Not_Code_Filename{$file}; # (unknown) return $language if $file =~ m{~$}; # a temp edit file (unknown) + if (defined $Language_by_File{$file}) { + if ($Language_by_File{$file} eq "Ant/XML") { + return Ant_or_XML( $full_file, $rh_Err, $raa_errors); + } elsif ($Language_by_File{$file} eq "Maven/XML") { + return Maven_or_XML($full_file, $rh_Err, $raa_errors); + } else { + return $Language_by_File{$file}; + } + } if ($file =~ /\.(\w+)$/) { # has an extension - print "$full_file extension=[$1]\n" if $opt_v > 2; - my $extension = $1; - # Windows file names are case insensitive so map - # all extensions to lowercase there. - $extension = lc $extension if $ON_WINDOWS; + print "$full_file extension=[$1]\n" if $opt_v > 2; + my $extension = $1; + # Windows file names are case insensitive so map + # all extensions to lowercase there. + $extension = lc $extension if $ON_WINDOWS; + my @extension_list = ( $extension ); + if ($file =~ /\.(\w+\.\w+)$/) { # has a double extension + my $extension = $1; + $extension = lc $extension if $ON_WINDOWS; + unshift @extension_list, $extension; # examine double ext first + } + foreach my $extension (@extension_list) { if ($Not_Code_Extension{$extension} and !$Forced_Extension{$extension}) { # If .1 (for example) is an extention that would ordinarily be @@ -2398,14 +3161,44 @@ 'failure in matlab_or_objective_C()'; return $language; # (unknown) } + } elsif ($Language_by_Extension{$extension} eq 'PHP/Pascal') { + if (really_is_php($full_file)) { + return 'PHP'; + } elsif (really_is_incpascal($full_file)) { + return 'Pascal'; + } else { + return $language; # (unknown) + } + } elsif ($Language_by_Extension{$extension} eq 'Lisp/OpenCL') { + return Lisp_or_OpenCL($full_file, $rh_Err, $raa_errors); + } elsif ($Language_by_Extension{$extension} eq 'Smarty') { + # Smarty extension .tpl is generic; make sure the + # file at least roughly resembles PHP. Alternatively, + # if the user forces the issue, do the count. + my $force_smarty = 0; + foreach (@opt_force_lang) { + if (lc($_) eq "smarty,tpl") { + $force_smarty = 1; + last; + } + } + if (really_is_php($full_file) or $force_smarty) { + return 'Smarty'; + } else { + return $language; # (unknown) + } } else { return $Language_by_Extension{$extension}; } } else { # has an unmapped file extension $look_at_first_line = 1; } + } } elsif (defined $Language_by_File{lc $file}) { return $Language_by_File{lc $file}; + } elsif ($opt_lang_no_ext and + defined $Filters_by_Language{$opt_lang_no_ext}) { + return $opt_lang_no_ext; } else { # no file extension $look_at_first_line = 1; } @@ -2502,6 +3295,7 @@ if ($HAVE_Digest_MD5) { binmode $IN; my $MD5 = Digest::MD5->new->addfile($IN)->hexdigest; +#print "$F, $MD5\n"; push @{$file_hash{$MD5}}, $F; } else { # all files treated unique @@ -2525,7 +3319,16 @@ \@nul_a, \%nul_h); $i_best = $i if $language ne "(unknown)"; } - push @unique, $file_hash{$md5}[$i_best]; + # keep the best one found and identify the rest as ignored + for (my $i = 0; $i < scalar(@{$file_hash{$md5}}); $i++) { + if ($i == $i_best) { + push @unique, $file_hash{$md5}[$i_best]; + } else { + $rh_ignored->{$file_hash{$md5}[$i]} = "duplicate of " . + $file_hash{$md5}[$i_best]; + } + } + } print "<- different_files(@unique)\n" if $opt_v > 2; return @unique; @@ -2573,12 +3376,13 @@ my $total_lines = scalar @lines; print_lines($file, "Original file:", \@lines) if $opt_print_filter_stages; - @lines = rm_blanks(\@lines, $language); # remove blank lines + @lines = rm_blanks(\@lines, $language, \%EOL_Continuation_re); # remove blank lines my $blank_lines = $total_lines - scalar @lines; print_lines($file, "Blank lines removed:", \@lines) if $opt_print_filter_stages; - @lines = rm_comments(\@lines, $language, $file); + @lines = rm_comments(\@lines, $language, $file, + \%EOL_Continuation_re); my $comment_lines = $total_lines - $blank_lines - scalar @lines; if ($opt_strip_comments) { @@ -2646,7 +3450,7 @@ if ($ON_WINDOWS) { $file = (windows_glob($file))[0]; } else { - $file = glob($file); # sometimes returns null string + $file = File::Glob::glob($file); } #print "write_file 3 [$file]\n"; $file = $preglob_filename unless $file; @@ -2667,9 +3471,9 @@ } else { warn "Unable to write to $file\n"; } - print "Wrote $file"; + print "Wrote $file" unless $opt_quiet; print ", $CLOC_XSL" if $opt_xsl and $opt_xsl eq $CLOC_XSL; - print "\n"; + print "\n" unless $opt_quiet; print "<- write_file\n" if $opt_v > 2; } # 1}}} @@ -2682,8 +3486,11 @@ if (defined $IN) { @lines = <$IN>; $IN->close; - # Some files don't end with a new line. Force this: - $lines[$#lines] .= "\n" unless $lines[$#lines] =~ m/\n$/; + if ($lines[$#lines]) { # test necessary for zero content files + # (superfluous?) + # Some files don't end with a new line. Force this: + $lines[$#lines] .= "\n" unless $lines[$#lines] =~ m/\n$/; + } } else { warn "Unable to read $file\n"; } @@ -2691,14 +3498,24 @@ return @lines; } # 1}}} sub rm_blanks { # {{{1 - my ($ra_in, $language) = @_; + my ($ra_in , + $language , + $rh_EOL_continuation_re) = @_; + print "-> rm_blanks(language=$language)\n" if $opt_v > 2; #print "rm_blanks: language = [$language]\n"; my @out = (); if ($language eq "COBOL") { @out = remove_cobol_blanks($ra_in); } else { - @out = remove_matches($ra_in, '^\s*$'); # removes blank lines + # removes blank lines + if (defined $rh_EOL_continuation_re->{$language}) { + @out = remove_matches_2re($ra_in, '^\s*$', + $rh_EOL_continuation_re->{$language}); + } else { + @out = remove_matches($ra_in, '^\s*$'); + } } + print "<- rm_blanks(language=$language)\n" if $opt_v > 2; return @out; } # 1}}} sub rm_comments { # {{{1 @@ -2706,7 +3523,9 @@ $language , # in $file , # in (some language counters, eg Haskell, need # access to the original file) + $rh_EOL_continuation_re , # in ) = @_; + print "-> rm_comments(file=$file)\n" if $opt_v > 2; my @routines = @{$Filters_by_Language{$language}}; my @lines = @{$ra_lines}; my @original_lines = @{$ra_lines}; @@ -2730,7 +3549,13 @@ print_lines($file, "After $subroutine(@args)", \@lines) if $opt_print_filter_stages; - @lines = remove_matches(\@lines, '^\s*$'); # then remove blank lines + # then remove blank lines which are created by comment removal + if (defined $rh_EOL_continuation_re->{$language}) { + @lines = remove_matches_2re(\@lines, '^\s*$', + $rh_EOL_continuation_re->{$language}); + } else { + @lines = remove_matches(\@lines, '^\s*$'); + } print_lines($file, "post $subroutine(@args) blank cleanup:", \@lines) if $opt_print_filter_stages; @@ -2743,6 +3568,7 @@ $lines[0] ne $original_lines[0])) { unshift @lines, $original_lines[0]; # add the first line back } + print "<- rm_comments\n" if $opt_v > 2; return @lines; } # 1}}} sub remove_f77_comments { # {{{1 @@ -2795,6 +3621,31 @@ #print "remove_matches returning\n ", join("\n ", @save_lines), "\n"; return @save_lines; } # 1}}} +sub remove_matches_2re { # {{{1 + my ($ra_lines, # in + $pattern1, # in Perl regex 1 (case insensitive) to match + $pattern2, # in Perl regex 2 (case insensitive) to not match prev line + ) = @_; + print "-> remove_matches_2re(pattern=$pattern1,$pattern2)\n" if $opt_v > 2; + + my @save_lines = (); + for (my $i = 0; $i < scalar @{$ra_lines}; $i++) { +#print "remove_matches_2re [$pattern1] [$pattern2] [$ra_lines->[$i]]\n"; + if ($i) { +#print "remove_matches_2re prev=[$ra_lines->[$i-1]] this=[$ra_lines->[$i]]\n"; + next if ($ra_lines->[$i] =~ m{$pattern1}i) and + ($ra_lines->[$i-1] !~ m{$pattern2}i); + } else { + # on first line + next if $ra_lines->[$i] =~ m{$pattern1}i; + } + push @save_lines, $ra_lines->[$i]; + } + + print "<- remove_matches_2re\n" if $opt_v > 2; +#print "remove_matches_2re returning\n ", join("\n ", @save_lines), "\n"; + return @save_lines; +} # 1}}} sub remove_inline { # {{{1 my ($ra_lines, # in $pattern , # in Perl regular expression (case insensitive) @@ -2923,6 +3774,38 @@ print "<- remove_between\n" if $opt_v > 2; return split("\n", $all_lines); } # 1}}} +sub remove_between_general { # {{{1 + my ($ra_lines, $start_marker, $end_marker, ) = @_; + # Start and end markers may be any length strings. + + print "-> remove_between_general(start=$start_marker, end=$end_marker)\n" + if $opt_v > 2; + + my $all_lines = join("", @{$ra_lines}); + + my @save_lines = (); + my $in_comment = 0; + foreach (@{$ra_lines}) { + + next if /^\s*$/; + s/\Q$start_marker\E.*?\Q$end_marker\E//g; # strip one-line comments + next if /^\s*$/; + if ($in_comment) { + if (/\Q$end_marker\E/) { + s/^.*?\Q$end_marker\E//; + $in_comment = 0; + } + } + next if /^\s*$/; + $in_comment = 1 if /^(.*?)\Q$start_marker\E/; + next if defined $1 and $1 =~ /^\s*$/; + next if ($in_comment); + push @save_lines, $_; + } + + print "<- remove_between_general\n" if $opt_v > 2; + return @save_lines; +} # 1}}} sub remove_cobol_blanks { # {{{1 # subroutines derived from SLOCCount my ($ra_lines, ) = @_; @@ -3079,6 +3962,35 @@ print "<- docstring_to_C\n" if $opt_v > 2; return @{$ra_lines}; } # 1}}} +sub powershell_to_C { # {{{1 + my ($ra_lines, ) = @_; + # Converts PowerShell block comment markers to C comments. + + print "-> powershell_to_C()\n" if $opt_v > 2; + + my $in_docstring = 0; + foreach (@{$ra_lines}) { + s{<#}{/*}g; + s{#>}{*/}g; + } + + print "<- powershell_to_C\n" if $opt_v > 2; + return @{$ra_lines}; +} # 1}}} +sub smarty_to_C { # {{{1 + my ($ra_lines, ) = @_; + # Converts Smarty comments to C comments. + + print "-> smarty_to_C()\n" if $opt_v > 2; + + foreach (@{$ra_lines}) { + s[{\*][/*]g; + s[\*}][*/]g; + } + + print "<- smarty_to_C\n" if $opt_v > 2; + return @{$ra_lines}; +} # 1}}} sub determine_lit_type { # {{{1 my ($file) = @_; @@ -3159,15 +4071,17 @@ $rh_Not_Code_Filename , # out $rh_Scale_Factor , # out $rh_Known_Binary_Archives , # out + $rh_EOL_continuation_re , # out ) = @_; # 1}}} -%{$rh_Language_by_Extension} = ( # {{{1 +%{$rh_Language_by_Extension} = ( # {{{1 'abap' => 'ABAP' , 'ac' => 'm4' , 'ada' => 'Ada' , 'adb' => 'Ada' , 'ads' => 'Ada' , 'adso' => 'ADSO/IDSM' , + 'ahk' => 'AutoHotkey' , 'am' => 'make' , 'ample' => 'AMPLE' , 'as' => 'ActionScript' , @@ -3182,33 +4096,45 @@ 'aspx' => 'ASP.Net' , 'master' => 'ASP.Net' , 'sitemap' => 'ASP.Net' , + 'cshtml' => 'Razor' , 'awk' => 'awk' , 'bash' => 'Bourne Again Shell' , 'bas' => 'Visual Basic' , 'bat' => 'DOS Batch' , 'BAT' => 'DOS Batch' , + 'build.xml' => 'Ant' , 'cbl' => 'COBOL' , 'CBL' => 'COBOL' , 'c' => 'C' , 'C' => 'C++' , 'cc' => 'C++' , 'ccs' => 'CCS' , + 'cfc' => 'ColdFusion CFScript' , 'cfm' => 'ColdFusion' , - 'cl' => 'Lisp' , - 'cls' => 'Visual Basic' , + 'cl' => 'Lisp/OpenCL' , + 'clj' => 'Clojure' , + 'cljs' => 'ClojureScript' , + 'cls' => 'Visual Basic' , # also Apex Class + 'CMakeLists.txt' => 'CMake' , + 'cmake' => 'CMake' , 'cob' => 'COBOL' , 'COB' => 'COBOL' , + 'coffee' => 'CoffeeScript' , + 'component' => 'Visualforce Component' , 'config' => 'ASP.Net' , 'cpp' => 'C++' , 'cs' => 'C#' , 'csh' => 'C Shell' , 'css' => "CSS" , + 'ctl' => 'Visual Basic' , 'cxx' => 'C++' , 'd' => 'D' , 'da' => 'DAL' , + 'dart' => 'Dart' , 'def' => 'Teamcenter def' , 'dmap' => 'NASTRAN DMAP' , 'dpr' => 'Pascal' , + 'dsr' => 'Visual Basic' , 'dtd' => 'DTD' , 'ec' => 'C' , 'el' => 'Lisp' , @@ -3227,7 +4153,9 @@ 'frm' => 'Visual Basic' , 'gnumakefile' => 'make' , 'Gnumakefile' => 'make' , + 'go' => 'Go' , 'groovy' => 'Groovy' , + 'gant' => 'Groovy' , 'h' => 'C/C++ Header' , 'H' => 'C/C++ Header' , 'hh' => 'C/C++ Header' , @@ -3238,21 +4166,29 @@ 'html' => 'HTML' , 'i3' => 'Modula3' , 'idl' => 'IDL' , + 'ism' => 'InstallShield' , + 'pro' => 'IDL' , 'ig' => 'Modula3' , 'il' => 'SKILL' , 'ils' => 'SKILL++' , - 'inc' => 'inc' , # might be PHP + 'inc' => 'PHP/Pascal' , # might be PHP or Pascal + 'ino' => 'Arduino Sketch' , + 'pde' => 'Arduino Sketch' , # pre 1.0 'itk' => 'Tcl/Tk' , 'java' => 'Java' , 'jcl' => 'JCL' , # IBM Job Control Lang. 'jl' => 'Lisp' , 'js' => 'Javascript' , + 'jsf' => 'JavaServer Faces' , + 'xhtml' => 'JavaServer Faces' , 'jsp' => 'JSP' , # Java server pages 'ksc' => 'Kermit' , 'ksh' => 'Korn Shell' , 'lhs' => 'Haskell' , 'l' => 'lex' , + 'less' => 'LESS' , 'lsp' => 'Lisp' , + 'lisp' => 'Lisp' , 'lua' => 'Lua' , 'm3' => 'Modula3' , 'm4' => 'm4' , @@ -3260,15 +4196,21 @@ 'Makefile' => 'make' , 'met' => 'Teamcenter met' , 'mg' => 'Modula3' , - 'mli' => 'ML' , - 'ml' => 'ML' , +# 'mli' => 'ML' , # ML not implemented +# 'ml' => 'ML' , + 'ml' => 'OCaml' , + 'mli' => 'OCaml' , + 'mly' => 'OCaml' , + 'mll' => 'OCaml' , 'm' => 'MATLAB/Objective C/MUMPS' , - 'wdproj' => 'MSBuild scripts' , - 'csproj' => 'MSBuild scripts' , + 'mm' => 'Objective C++' , + 'wdproj' => 'MSBuild scripts' , + 'csproj' => 'MSBuild scripts' , 'mps' => 'MUMPS' , 'mth' => 'Teamcenter mth' , 'oscript' => 'LiveLink OScript' , 'pad' => 'Ada' , # Oracle Ada preprocessor + 'page' => 'Visualforce Page' , 'pas' => 'Pascal' , 'pcc' => 'C++' , # Oracle C++ preprocessor 'perl' => 'Perl' , @@ -3278,20 +4220,26 @@ 'php4' => 'PHP' , 'php5' => 'PHP' , 'php' => 'PHP' , + 'pig' => 'Pig Latin' , 'plh' => 'Perl' , 'pl' => 'Perl' , 'PL' => 'Perl' , 'plx' => 'Perl' , 'pm' => 'Perl' , + 'pom.xml' => 'Maven' , + 'pom' => 'Maven' , 'p' => 'Pascal' , 'pp' => 'Pascal' , 'psql' => 'SQL' , 'py' => 'Python' , + 'pyx' => 'Cython' , + 'qml' => 'QML' , 'rb' => 'Ruby' , # 'resx' => 'ASP.Net' , 'rex' => 'Oracle Reports' , 'rexx' => 'Rexx' , 'rhtml' => 'Ruby HTML' , + 'rs' => 'Rust' , 's' => 'Assembly' , 'S' => 'Assembly' , 'scala' => 'Scala' , @@ -3302,12 +4250,28 @@ 'sed' => 'sed' , 'ses' => 'Patran Command Language' , 'pcl' => 'Patran Command Language' , + 'ps1' => 'PowerShell' , + 'sass' => 'SASS' , + 'scss' => 'SASS' , 'sh' => 'Bourne Shell' , + 'smarty' => 'Smarty' , 'sql' => 'SQL' , 'SQL' => 'SQL' , + 'sproc.sql' => 'SQL Stored Procedure' , + 'spoc.sql' => 'SQL Stored Procedure' , + 'spc.sql' => 'SQL Stored Procedure' , + 'udf.sql' => 'SQL Stored Procedure' , + 'data.sql' => 'SQL Data' , + 'v' => 'Verilog-SystemVerilog' , + 'sv' => 'Verilog-SystemVerilog' , + 'svh' => 'Verilog-SystemVerilog' , 'tcl' => 'Tcl/Tk' , 'tcsh' => 'C Shell' , 'tk' => 'Tcl/Tk' , + 'tpl' => 'Smarty' , + 'trigger' => 'Apex Trigger' , + 'vala' => 'Vala' , + 'vapi' => 'Vala Header' , 'vhd' => 'VHDL' , 'VHD' => 'VHDL' , 'vhdl' => 'VHDL' , @@ -3323,6 +4287,7 @@ 'webinfo' => 'ASP.Net' , 'xml' => 'XML' , 'XML' => 'XML' , + 'mxml' => 'MXML' , 'build' => 'NAnt scripts' , 'vim' => 'vim script' , 'xaml' => 'XAML' , @@ -3337,7 +4302,7 @@ 'yml' => 'YAML' , ); # 1}}} -%{$rh_Language_by_Script} = ( # {{{1 +%{$rh_Language_by_Script} = ( # {{{1 'awk' => 'awk' , 'bash' => 'Bourne Again Shell' , 'bc' => 'bc' ,# calculator @@ -3360,14 +4325,17 @@ 'wish' => 'Tcl/Tk' , ); # 1}}} -%{$rh_Language_by_File} = ( # {{{1 - 'Makefile' => 'make' , - 'makefile' => 'make' , - 'gnumakefile' => 'make' , - 'Gnumakefile' => 'make' , +%{$rh_Language_by_File} = ( # {{{1 + 'Makefile' => 'make' , + 'makefile' => 'make' , + 'gnumakefile' => 'make' , + 'Gnumakefile' => 'make' , + 'CMakeLists.txt' => 'CMake' , + 'build.xml' => 'Ant/XML' , + 'pom.xml' => 'Maven/XML' , ); # 1}}} -%{$rhaa_Filters_by_Language} = ( # {{{1 +%{$rhaa_Filters_by_Language} = ( # {{{1 'ABAP' => [ [ 'remove_matches' , '^\*' ], ], 'ActionScript' => [ [ 'remove_matches' , '^\s*//' ], @@ -3379,6 +4347,24 @@ 'Ada' => [ [ 'remove_matches' , '^\s*--' ], ], 'ADSO/IDSM' => [ [ 'remove_matches' , '^\s*\*[\+\!]' ], ], 'AMPLE' => [ [ 'remove_matches' , '^\s*//' ], ], + 'Ant/XML' => [ + [ 'remove_html_comments', ], + [ 'call_regexp_common' , 'HTML' ], + ], + 'Ant' => [ + [ 'remove_html_comments', ], + [ 'call_regexp_common' , 'HTML' ], + ], + 'Apex Trigger' => [ + [ 'remove_matches' , '^\s*//' ], + [ 'call_regexp_common' , 'C' ], + [ 'remove_inline' , '//.*$' ], + ], + 'Arduino Sketch' => [ # same as C + [ 'remove_matches' , '^\s*//' ], + [ 'call_regexp_common' , 'C' ], + [ 'remove_inline' , '//.*$' ], + ], 'Assembly' => [ [ 'remove_matches' , '^\s*//' ], [ 'remove_matches' , '^\s*;' ], @@ -3386,6 +4372,10 @@ [ 'remove_inline' , '//.*$' ], [ 'remove_inline' , ';.*$' ], ], + 'AutoHotkey' => [ + [ 'remove_matches' , '^\s*;' ], + [ 'remove_inline' , ';.*$' ], + ], 'awk' => [ [ 'remove_matches' , '^\s*#' ], [ 'remove_inline' , '#.*$' ], @@ -3409,12 +4399,19 @@ [ 'call_regexp_common' , 'C' ], [ 'remove_inline' , '//.*$' ], ], - 'C#' => [ - [ 'remove_matches' , '^\s*//' ], - [ 'call_regexp_common' , 'C' ], - [ 'remove_inline' , '//.*$' ], + 'Clojure' => [ [ 'remove_matches' , '^\s*;' ], ], + 'ClojureScript' => [ [ 'remove_matches' , '^\s*;' ], ], + 'CMake' => [ + [ 'remove_matches' , '^\s*#' ], + [ 'remove_inline' , '#.*$' ], ], - 'D' => [ + 'Cython' => [ + [ 'remove_matches' , '^\s*#' ], + [ 'docstring_to_C' ], + [ 'call_regexp_common' , 'C' ], + [ 'remove_inline' , '#.*$' ], + ], + 'C#' => [ [ 'remove_matches' , '^\s*//' ], [ 'call_regexp_common' , 'C' ], [ 'remove_inline' , '//.*$' ], @@ -3422,10 +4419,30 @@ 'CCS' => [ [ 'call_regexp_common' , 'C' ], ], 'CSS' => [ [ 'call_regexp_common' , 'C' ], ], 'COBOL' => [ [ 'remove_cobol_comments', ], ], + 'CoffeeScript' => [ + [ 'remove_matches' , '^\s*#' ], + [ 'remove_inline' , '#.*$' ], + ], 'ColdFusion' => [ [ 'remove_html_comments', ], [ 'call_regexp_common' , 'HTML' ], ], + 'ColdFusion CFScript'=> [ + [ 'remove_matches' , '^\s*//' ], + [ 'call_regexp_common' , 'C' ], + [ 'remove_inline' , '//.*$' ], + ], 'Crystal Reports' => [ [ 'remove_matches' , '^\s*//' ], ], + 'D' => [ + [ 'remove_matches' , '^\s*//' ], + [ 'remove_between_general', '/+', '+/' ], + [ 'call_regexp_common' , 'C' ], + [ 'remove_inline' , '//.*$' ], + ], 'DAL' => [ [ 'remove_between' , '[]', ], ], + 'Dart' => [ + [ 'remove_matches' , '^\s*//' ], + [ 'remove_inline' , '//.*$' ], + [ 'call_regexp_common' , 'C' ], + ], 'NASTRAN DMAP' => [ [ 'remove_matches' , '^\s*\$' ], [ 'remove_inline' , '\$.*$' ], @@ -3456,6 +4473,11 @@ [ 'remove_f90_comments' , ], [ 'remove_inline' , '\!.*$' ], ], + 'Go' => [ + [ 'remove_matches' , '^\s*//' ], + [ 'remove_inline' , '//.*$' ], + [ 'call_regexp_common' , 'C' ], + ], 'Groovy' => [ [ 'remove_matches' , '^\s*//' ], [ 'remove_inline' , '//.*$' ], @@ -3465,6 +4487,8 @@ [ 'call_regexp_common' , 'HTML' ], ], 'Haskell' => [ [ 'remove_haskell_comments', '>filename<' ], ], 'IDL' => [ [ 'remove_matches' , '^\s*;' ], ], + 'InstallShield' => [ [ 'remove_html_comments', ], + [ 'call_regexp_common' , 'HTML' ], ], 'JSP' => [ [ 'remove_html_comments', ], [ 'call_regexp_common' , 'HTML' ], [ 'remove_jsp_comments' , ], @@ -3472,6 +4496,11 @@ [ 'add_newlines' , ], [ 'call_regexp_common' , 'C' ], ], + 'JavaServer Faces' => [ + [ 'remove_matches' , '^\s*//' ], + [ 'call_regexp_common' , 'C' ], + [ 'remove_inline' , '//.*$' ], + ], 'Java' => [ [ 'remove_matches' , '^\s*//' ], [ 'call_regexp_common' , 'C' ], @@ -3483,7 +4512,13 @@ [ 'remove_inline' , '//.*$' ], ], 'JCL' => [ [ 'remove_jcl_comments' , ], ], + 'LESS' => [ + [ 'remove_matches' , '^\s*//' ], + [ 'call_regexp_common' , 'C' ], + [ 'remove_inline' , '//.*$' ], + ], 'Lisp' => [ [ 'remove_matches' , '^\s*;' ], ], + 'Lisp/OpenCL' => [ [ 'die' , ], ], # never called 'LiveLink OScript' => [ [ 'remove_matches' , '^\s*//' ], ], # 'Lua' => [ [ 'call_regexp_common' , 'lua' ], ], 'Lua' => [ [ 'remove_matches' , '^\s*\-\-' ], ], @@ -3495,6 +4530,14 @@ [ 'remove_matches' , '^\s*%' ], [ 'remove_inline' , '%.*$' ], ], + 'Maven/XML' => [ + [ 'remove_html_comments', ], + [ 'call_regexp_common' , 'HTML' ], + ], + 'Maven' => [ + [ 'remove_html_comments', ], + [ 'call_regexp_common' , 'HTML' ], + ], 'Modula3' => [ [ 'call_regexp_common' , 'Pascal' ], ], # Modula 3 comments are (* ... *) so applying the Pascal filter # which also treats { ... } as a comment is not really correct. @@ -3503,6 +4546,20 @@ [ 'call_regexp_common' , 'C' ], [ 'remove_inline' , '//.*$' ], ], + 'Objective C++' => [ + [ 'remove_matches' , '^\s*//' ], + [ 'call_regexp_common' , 'C' ], + [ 'remove_inline' , '//.*$' ], + ], + 'OCaml' => [ + [ 'call_regexp_common' , 'Pascal' ], + ], + 'OpenCL' => [ + [ 'remove_matches' , '^\s*//' ], # C99 + [ 'call_regexp_common' , 'C' ], + [ 'remove_inline' , '//.*$' ], # C99 + ], + 'PHP/Pascal' => [ [ 'die' , ], ], # never called 'MATLAB/Objective C/MUMPS' => [ [ 'die' , ], ], # never called 'MUMPS' => [ [ 'remove_matches' , '^\s*;' ], ], 'Octave' => [ @@ -3511,7 +4568,10 @@ ], 'Oracle Forms' => [ [ 'call_regexp_common' , 'C' ], ], 'Oracle Reports' => [ [ 'call_regexp_common' , 'C' ], ], - 'Pascal' => [ [ 'call_regexp_common' , 'Pascal' ], ], + 'Pascal' => [ + [ 'call_regexp_common' , 'Pascal' ], + [ 'remove_matches' , '^\s*//' ], + ], 'Patran Command Language'=> [ [ 'remove_matches' , '^\s*#' ], [ 'remove_matches' , '^\s*\$#' ], @@ -3522,11 +4582,23 @@ [ 'remove_below_above' , '^=head1', '^=cut' ], [ 'remove_inline' , '#.*$' ], ], - 'Python' => [ [ 'remove_matches' , '^\s*#' ], + 'Pig Latin' => [ + [ 'remove_matches' , '^\s*--' ], + [ 'remove_inline' , '--.*$' ], + [ 'call_regexp_common' , 'C' ], + ], + 'PowerShell' => [ + [ 'powershell_to_C' ], + [ 'call_regexp_common' , 'C' ], + [ 'remove_matches' , '^\s*#' ], + [ 'remove_inline' , '#.*$' ], + ], + 'Python' => [ + [ 'remove_matches' , '^\s*#' ], [ 'docstring_to_C' ], [ 'call_regexp_common' , 'C' ], [ 'remove_inline' , '#.*$' ], - ], + ], 'PHP' => [ [ 'remove_matches' , '^\s*#' ], [ 'remove_matches' , '^\s*//' ], @@ -3534,13 +4606,35 @@ [ 'remove_inline' , '#.*$' ], [ 'remove_inline' , '//.*$' ], ], + 'QML' => [ + [ 'remove_matches' , '^\s*//' ], + [ 'call_regexp_common' , 'C' ], + [ 'remove_inline' , '//.*$' ], + ], + 'Razor' => [ + [ 'remove_matches' , '^\s*//' ], + [ 'remove_between_general', '@*', '*@' ], + [ 'call_regexp_common' , 'C' ], + [ 'remove_inline' , '//.*$' ], + ], 'Rexx' => [ [ 'call_regexp_common' , 'C' ], ], 'Ruby' => [ [ 'remove_matches' , '^\s*#' ], + [ 'remove_below_above' , '^=begin', '^=end' ], [ 'remove_inline' , '#.*$' ], ], 'Ruby HTML' => [ [ 'remove_html_comments', ], [ 'call_regexp_common' , 'HTML' ], ], + 'Rust' => [ + [ 'remove_matches' , '^\s*//' ], + [ 'remove_inline' , '//.*$' ], + [ 'call_regexp_common' , 'C' ], + ], + 'SASS' => [ + [ 'remove_matches' , '^\s*//' ], + [ 'call_regexp_common' , 'C' ], + [ 'remove_inline' , '//.*$' ], + ], 'Scala' => [ [ 'remove_matches' , '^\s*//' ], [ 'remove_inline' , '//.*$' ], @@ -3559,10 +4653,24 @@ [ 'remove_matches' , '^\s*--' ], [ 'remove_inline' , '--.*$' ], ], + 'SQL Stored Procedure'=> [ + [ 'call_regexp_common' , 'C' ], + [ 'remove_matches' , '^\s*--' ], + [ 'remove_inline' , '--.*$' ], + ], + 'SQL Data' => [ + [ 'call_regexp_common' , 'C' ], + [ 'remove_matches' , '^\s*--' ], + [ 'remove_inline' , '--.*$' ], + ], 'sed' => [ [ 'remove_matches' , '^\s*#' ], [ 'remove_inline' , '#.*$' ], ], + 'Smarty' => [ + [ 'smarty_to_C' ], + [ 'call_regexp_common' , 'C' ], + ], 'Bourne Again Shell' => [ [ 'remove_matches' , '^\s*#' ], [ 'remove_inline' , '#.*$' ], @@ -3596,8 +4704,23 @@ [ 'remove_matches' , '^\s*Attribute\s+'], [ 'remove_matches' , '^\s*\47'], ], # \47 = ' # http://www.altium.com/files/learningguides/TR0114%20VHDL%20Language%20Reference.pdf - 'VHDL' => [ - [ 'remove_matches' , '^\s*--' ], + 'Vala' => [ + [ 'remove_matches' , '^\s*//' ], + [ 'call_regexp_common' , 'C' ], + [ 'remove_inline' , '//.*$' ], + ], + 'Vala Header' => [ + [ 'remove_matches' , '^\s*//' ], + [ 'call_regexp_common' , 'C' ], + [ 'remove_inline' , '//.*$' ], + ], + 'Verilog-SystemVerilog' => [ + [ 'remove_matches' , '^\s*//' ], + [ 'remove_inline' , '//.*$' ], + [ 'call_regexp_common' , 'C' ], + ], + 'VHDL' => [ + [ 'remove_matches' , '^\s*--' ], [ 'remove_matches' , '^\s*//' ], [ 'call_regexp_common' , 'C' ], [ 'remove_inline' , '--.*$' ], @@ -3610,7 +4733,19 @@ 'Visual Basic' => [ [ 'remove_above' , '^\s*Attribute\s+VB_Name\s+=' ], [ 'remove_matches' , '^\s*Attribute\s+'], [ 'remove_matches' , '^\s*\47'], ], # \47 = ' - 'yacc' => [ [ 'call_regexp_common' , 'C' ], ], + 'Visualforce Component' => [ + [ 'remove_html_comments', ], + [ 'call_regexp_common' , 'HTML' ], + ], + 'Visualforce Page' => [ + [ 'remove_html_comments', ], + [ 'call_regexp_common' , 'HTML' ], + ], + 'yacc' => [ + [ 'call_regexp_common' , 'C' ], + [ 'remove_matches' , '^\s*//' ], + [ 'remove_inline' , '//.*$' ], + ], 'YAML' => [ [ 'remove_matches' , '^\s*#' ], [ 'remove_inline' , '#.*$' ], @@ -3618,6 +4753,13 @@ 'lex' => [ [ 'call_regexp_common' , 'C' ], ], 'XAML' => [ [ 'remove_html_comments', ], [ 'call_regexp_common' , 'HTML' ], ], + 'MXML' => [ + [ 'remove_html_comments', ], + [ 'call_regexp_common' , 'HTML' ], + [ 'remove_matches' , '^\s*//' ], + [ 'add_newlines' , ], + [ 'call_regexp_common' , 'C' ], + ], 'XML' => [ [ 'remove_html_comments', ], [ 'call_regexp_common' , 'HTML' ], ], 'XSD' => [ [ 'remove_html_comments', ], @@ -3630,7 +4772,52 @@ [ 'call_regexp_common' , 'HTML' ], ], ); # 1}}} -%{$rh_Not_Code_Extension} = ( # {{{1 +%{$rh_EOL_continuation_re} = ( # {{{1 + 'ActionScript' => '\\\\$' , + 'Assembly' => '\\\\$' , + 'ASP' => '\\\\$' , + 'ASP.Net' => '\\\\$' , + 'Ada' => '\\\\$' , + 'awk' => '\\\\$' , + 'bc' => '\\\\$' , + 'C' => '\\\\$' , + 'C++' => '\\\\$' , + 'C/C++ Header' => '\\\\$' , + 'CMake' => '\\\\$' , + 'Cython' => '\\\\$' , + 'C#' => '\\\\$' , + 'D' => '\\\\$' , + 'Dart' => '\\\\$' , + 'Expect' => '\\\\$' , + 'Go' => '\\\\$' , + 'Java' => '\\\\$' , + 'Javascript' => '\\\\$' , + 'LESS' => '\\\\$' , + 'Lua' => '\\\\$' , + 'make' => '\\\\$' , + 'MATLAB' => '\.\.\.\s*$' , + 'MXML' => '\\\\$' , + 'Objective C' => '\\\\$' , + 'Objective C++' => '\\\\$' , + 'OCaml' => '\\\\$' , + 'Octave' => '\.\.\.\s*$' , + 'Patran Command Language'=> '\\\\$' , + 'PowerShell' => '\\\\$' , + 'Python' => '\\\\$' , + 'Ruby' => '\\\\$' , + 'sed' => '\\\\$' , + 'Bourne Again Shell' => '\\\\$' , + 'Bourne Shell' => '\\\\$' , + 'C Shell' => '\\\\$' , + 'Kermit' => '\\\\$' , + 'Korn Shell' => '\\\\$' , + 'Tcl/Tk' => '\\\\$' , + 'lex' => '\\\\$' , + 'Vala' => '\\\\$' , + 'Vala Header' => '\\\\$' , + ); +# 1}}} +%{$rh_Not_Code_Extension} = ( # {{{1 '1' => 1, # Man pages (documentation): '2' => 1, '3' => 1, @@ -3692,7 +4879,7 @@ 'Z' => 1, # file compressed with "compress" 'zip' => 1, # zip archive ); # 1}}} -%{$rh_Not_Code_Filename} = ( # {{{1 +%{$rh_Not_Code_Filename} = ( # {{{1 'AUTHORS' => 1, 'BUGS' => 1, 'BUGS' => 1, @@ -3720,7 +4907,7 @@ 'TODO' => 1, ); # 1}}} -%{$rh_Scale_Factor} = ( # {{{1 +%{$rh_Scale_Factor} = ( # {{{1 '1032/af' => 5.00, '1st generation default' => 0.25, '2nd generation default' => 0.75, @@ -3751,11 +4938,15 @@ 'ambush' => 2.50, 'aml' => 1.63, 'AMPLE' => 2.00, + 'Ant/XML' => 1.90, + 'Ant' => 1.90, 'amppl ii' => 1.25, 'ansi basic' => 1.25, 'ansi cobol 74' => 0.75, 'ansi cobol 85' => 0.88, 'SQL' => 6.15, + 'SQL Stored Procedure' => 6.15, + 'SQL Data' => 1.00, 'answer/db' => 6.15, 'apl 360/370' => 2.50, 'apl default' => 2.50, @@ -3790,12 +4981,15 @@ 'webinfo' => 1.29, 'CCS' => 5.33, + 'Apex Trigger' => 1.4 , # 'assembler (basic)' => 0.25, + 'Arduino Sketch' => 1.00, 'Assembly' => 0.25, 'Assembly (macro)' => 0.51, 'associative default' => 1.25, 'autocoder' => 0.25, + 'AutoHotkey' => 1.29, 'awk' => 3.81, 'aztec c' => 0.63, 'balm' => 0.75, @@ -3826,7 +5020,8 @@ 'cbasic' => 0.88, 'cdadl' => 4.00, 'cellsim' => 1.74, -'ColdFusion' => 4.00, + 'ColdFusion' => 4.00, + 'ColdFusion CFScript' => 4.00, 'chili' => 0.75, 'chill' => 0.75, 'cics' => 1.74, @@ -3836,7 +5031,10 @@ 'clipper' => 2.05, 'clipper db' => 2.00, 'clos' => 3.81, + 'Clojure' => 1.25, + 'ClojureScript' => 1.25, 'clout' => 2.00, + 'CMake' => 1.00, 'cms2' => 0.75, 'cmsgen' => 4.21, 'COBOL' => 1.04, @@ -3845,6 +5043,7 @@ 'cobra' => 4.00, 'codecenter' => 2.22, 'cofac' => 2.22, + 'CoffeeScript' => 2.00, 'cogen' => 2.22, 'cognos' => 2.22, 'cogo' => 1.13, @@ -3870,6 +5069,7 @@ 'cygnet' => 4.21, 'D' => 1.70, 'DAL' => 1.50, + 'Dart' => 2.00, 'data base default' => 2.00, 'dataflex' => 2.00, 'datatrieve' => 4.00, @@ -3946,6 +5146,7 @@ 'gpss' => 1.74, 'guest' => 2.86, 'guru' => 1.63, + 'Go' => 2.50, 'Groovy' => 4.10, 'gw basic' => 0.82, 'Haskell' => 2.11, @@ -3955,6 +5156,7 @@ 'HTML' => 1.90 , 'XML' => 1.90 , +'MXML' => 1.90 , 'XSLT' => 1.90 , 'DTD' => 1.90 , 'XSD' => 1.90 , @@ -3985,6 +5187,7 @@ 'inquire' => 6.15, 'insight2' => 1.63, 'install/1' => 5.00, + 'InstallShield' => 1.90, 'intellect' => 1.51, 'interlisp' => 1.38, 'interpreted basic' => 0.75, @@ -3994,8 +5197,9 @@ 'j2ee' => 1.60, 'janus' => 1.13, 'Java' => 1.36, -'Javascript' => 1.48, -'JSP' => 1.48, + 'Javascript' => 1.48, + 'JavaServer Faces' => 1.5 , + 'JSP' => 1.48, 'JCL' => 1.67, 'joss' => 0.75, 'jovial' => 0.75, @@ -4014,6 +5218,7 @@ 'ladder logic' => 2.22, 'lambit/l' => 1.25, 'lattice c' => 0.63, + 'LESS' => 1.50, 'liana' => 0.63, 'lilith' => 1.13, 'linc ii' => 5.71, @@ -4041,6 +5246,7 @@ 'mark iv' => 2.00, 'mark v' => 2.22, 'mathcad' => 16.00, + 'Maven' => 1.90, 'mdl' => 2.22, 'mentor' => 1.51, 'mesa' => 0.75, @@ -4076,8 +5282,10 @@ 'object pascal' => 2.76, 'object star' => 5.00, 'Objective C' => 2.96, + 'Objective C++' => 2.96, 'objectoriented default' => 2.76, 'objectview' => 3.20, + 'OCaml' => 3.00, 'ogl' => 1.00, 'omnis 7' => 2.00, 'oodl' => 2.76, @@ -4099,6 +5307,7 @@ 'peoplesoft' => 2.50, 'Perl' => 4.00, 'persistance object builder' => 3.81, + 'Pig Latin' => 1.00, 'pilot' => 1.51, 'pl/1' => 1.38, 'pl/m' => 1.13, @@ -4114,6 +5323,7 @@ 'power basic' => 1.63, 'powerbuilder' => 3.33, 'powerhouse' => 5.71, + 'PowerShell' => 3.00, 'ppl (plus)' => 2.00, 'problemoriented default' => 1.13, 'proc' => 2.96, @@ -4128,6 +5338,7 @@ 'qbasic' => 1.38, 'qbe' => 6.15, 'qmf' => 5.33, + 'QML' => 1.25, 'qnial' => 1.63, 'quattro' => 13.33, 'quattro pro' => 13.33, @@ -4148,6 +5359,7 @@ 'realizer 2.0' => 2.22, 'relate/3000' => 2.00, 'reuse default' => 16.00, + 'Razor' => 2.00, 'Rexx' => 1.19, 'Rexx (mvs)' => 1.00, 'Rexx (os/2)' => 1.74, @@ -4158,6 +5370,7 @@ 'rpg ii' => 1.63, 'rpg iii' => 1.63, 'rtexpert 1.4' => 1.38, + 'Rust' => 1.00, 'sabretalk' => 0.90, 'sail' => 0.75, 'sapiens' => 5.00, @@ -4174,6 +5387,7 @@ 'ksh' => 3.81, 'C Shell' => 3.81, 'siebel tools ' => 6.15, + 'SASS' => 1.5 , 'simplan' => 2.22, 'simscript' => 1.74, 'simula' => 1.74, @@ -4186,6 +5400,7 @@ 'smalltalk 286' => 3.81, 'smalltalk 80' => 3.81, 'smalltalk/v' => 3.81, + 'Smarty' => 3.50, 'snap' => 1.00, 'snobol24' => 0.63, 'softscreen' => 5.71, @@ -4244,10 +5459,13 @@ 'uhelp' => 2.50, 'uniface' => 5.00, # 'unix shell scripts' => 3.81, + 'Vala' => 1.50, + 'Vala Header' => 1.40, 'vax acms' => 1.38, 'vax ade' => 2.00, 'vbscript' => 2.35, 'vectran' => 0.75, + 'Verilog-SystemVerilog' => 1.51, 'VHDL' => 4.21, 'vim script' => 3.00, 'visible c' => 1.63, @@ -4266,6 +5484,8 @@ 'visual cobol' => 4.00, 'visual objects' => 5.00, 'visualage' => 3.81, + 'Visualforce Component' => 1.9 , + 'Visualforce Page' => 1.9 , 'visualgen' => 4.44, 'vpf' => 0.84, 'vsrexx' => 2.50, @@ -4295,19 +5515,22 @@ 'inc' => 1.00, 'lex' => 1.00, 'MATLAB' => 4.00, +'Maven/XML' => 2.5, 'IDL' => 3.80, 'Octave' => 4.00, 'ML' => 3.00, 'Modula3' => 2.00, 'PHP' => 3.50, 'Python' => 4.20, +'Cython' => 3.80, 'Ruby' => 4.20, 'Ruby HTML' => 4.00, 'sed' => 4.00, 'Lua' => 4.00, +'OpenCL' => 1.50, ); # 1}}} -%{$rh_Known_Binary_Archives} = ( # {{{1 +%{$rh_Known_Binary_Archives} = ( # {{{1 '.tar' => 1 , '.tar.Z' => 1 , '.tar.gz' => 1 , @@ -4317,6 +5540,7 @@ '.ZIP' => 1 , '.ear' => 1 , # Java '.war' => 1 , # contained within .ear + '.xz' => 1 , ); # 1}}} } # end sub set_constants() @@ -5091,11 +6315,14 @@ $HAVE_Rexexp_Common = 0; my $dir = ""; if ($opt_sdir) { - # write to the user-defined scratch directory - $dir = $opt_sdir; + ++$TEMP_OFF; + $dir = "$opt_sdir/$TEMP_OFF"; + File::Path::rmtree($dir) if is_dir($dir); + File::Path::mkpath($dir) unless is_dir($dir); } else { # let File::Temp create a suitable temporary directory $dir = tempdir( CLEANUP => 1 ); # 1 = delete on exit + $TEMP_INST{ $dir } = "Regexp::Common"; } print "Using temp dir [$dir] to install Regexp::Common\n" if $opt_v; my $Regexp_dir = "$dir/Regexp"; @@ -5955,11 +7182,14 @@ $HAVE_Algorith_Diff = 0; my $dir = ""; if ($opt_sdir) { - # write to the user-defined scratch directory - $dir = $opt_sdir; + ++$TEMP_OFF; + $dir = "$opt_sdir/$TEMP_OFF"; + File::Path::rmtree($dir) if is_dir($dir); + File::Path::mkpath($dir) unless is_dir($dir); } else { # let File::Temp create a suitable temporary directory $dir = tempdir( CLEANUP => 1 ); # 1 = delete on exit + $TEMP_INST{ $dir } = "Algorithm::Diff"; } print "Using temp dir [$dir] to install Algorithm::Diff\n" if $opt_v; my $Algorithm_dir = "$dir/Algorithm"; @@ -6095,9 +7325,9 @@ ++$matlab_points; printf ".m: funct obj C=% 2d matlab=% 2d mumps=% 2d\n", $objective_C_points, $matlab_points, $mumps_points if $DEBUG; } elsif (m{^\s*%}) { # % + # matlab commented line --$objective_C_points; ++$matlab_points; - ++$mumps_points; printf ".m: pcent obj C=% 2d matlab=% 2d mumps=% 2d\n", $objective_C_points, $matlab_points, $mumps_points if $DEBUG; } } @@ -6117,6 +7347,114 @@ } } # 1}}} +sub Lisp_or_OpenCL { # {{{1 + my ($file , # in + $rh_Err , # in hash of error codes + $raa_errors , # out + ) = @_; + + print "-> Lisp_or_OpenCL\n" if $opt_v > 2; + + my $lang = undef; + my $IN = new IO::File $file, "r"; + if (!defined $IN) { + push @{$raa_errors}, [$rh_Err->{'Unable to read'} , $file]; + return $lang; + } + my $lisp_points = 0; + my $opcl_points = 0; + while (<$IN>) { + ++$lisp_points if /^\s*;/; + ++$lisp_points if /\((def|eval|require|export|let|loop|dec|format)/; + ++$opcl_points if /^\s*(int|float|const|{)/; + } + $IN->close; + # print "lisp_points=$lisp_points opcl_points=$opcl_points\n"; + if ($lisp_points > $opcl_points) { + $lang = "Lisp"; + } else { + $lang = "OpenCL"; + } + + print "<- Lisp_or_OpenCL\n" if $opt_v > 2; + return $lang; +} # 1}}} +sub Ant_or_XML { # {{{1 + my ($file , # in + $rh_Err , # in hash of error codes + $raa_errors , # out + ) = @_; + + print "-> Ant_or_XML($file)\n" if $opt_v > 2; + + my $lang = "XML"; + my $IN = new IO::File $file, "r"; + if (!defined $IN) { + push @{$raa_errors}, [$rh_Err->{'Unable to read'} , $file]; + return $lang; + } + my $Ant_points = 0; + my $XML_points = 1; + while (<$IN>) { + if (/^\s*close; + + if ($XML_points >= $Ant_points) { + # tie or better goes to XML + $lang = "XML"; + } else { + $lang = "Ant"; + } + + print "<- Ant_or_XML($lang)\n" if $opt_v > 2; + return $lang; +} # 1}}} +sub Maven_or_XML { # {{{1 + my ($file , # in + $rh_Err , # in hash of error codes + $raa_errors , # out + ) = @_; + + print "-> Maven_or_XML($file)\n" if $opt_v > 2; + + my $lang = "XML"; + my $IN = new IO::File $file, "r"; + if (!defined $IN) { + push @{$raa_errors}, [$rh_Err->{'Unable to read'} , $file]; + return $lang; + } + my $Mvn_points = 0; + my $XML_points = 1; + while (<$IN>) { + if (/^\s* 2; + return $lang; +} # 1}}} sub html_colored_text { # {{{1 # http://www.pagetutor.com/pagetutor/makapage/pics/net216-2.gif my ($color, $text) = @_; @@ -6335,6 +7673,9 @@ # {char}{type} = [ disposition (added, removed, etc)] # + @{$rah_diff_L} = (); + @{$rah_diff_R} = (); + print "-> array_diff()\n" if $opt_v > 2; my $COMMENT_MODE = 0; $COMMENT_MODE = 1 if $mode eq "comment"; @@ -6343,7 +7684,24 @@ #print Dumper("block left:" , $ra_lines_L); #print Dumper("block right:", $ra_lines_R); - my @sdiffs = sdiff($ra_lines_L, $ra_lines_R); + my @sdiffs = (); + eval { + local $SIG{ALRM} = sub { die "alarm\n" }; + alarm $opt_diff_timeout; + @sdiffs = sdiff($ra_lines_L, $ra_lines_R); + alarm 0; + }; + if ($@) { + # timed out + die unless $@ eq "alarm\n"; # propagate unexpected errors + push @{$raa_Errors}, + [ $Error_Codes{'Diff error, exceeded timeout'}, $file ]; + if ($opt_v) { + warn "array_diff: diff timeout failure for $file--ignoring\n"; + } + return; + } + #use Data::Dumper::Simple; #print Dumper($ra_lines_L, $ra_lines_R, @sdiffs); #die; @@ -6351,8 +7709,6 @@ my $n_L = 0; my $n_R = 0; my $n_sdiff = 0; # index to $rah_diff_L, $rah_diff_R - @{$rah_diff_L} = (); - @{$rah_diff_R} = (); foreach my $triple (@sdiffs) { my $flag = $triple->[0]; my $line_L = $triple->[1]; @@ -6484,6 +7840,7 @@ # b.txt # dir3/c.txt # + print "-> remove_leading_dir()\n" if $opt_v > 2; my @D = (); # a matrix: [ [ dir1, dir2 ], # dir1/dir2/a.txt # [ dir1, dir2 ], # dir1/dir2/b.txt # [ dir1, dir2 , dir3] ] # dir1/dir2/dir3/c.txt @@ -6493,6 +7850,13 @@ $F = ucfirst($F) if $F =~ /^\w:/; # uppercase drive letter } } + if (scalar @filenames == 1) { + # special case: with only one filename + # cannot determine a baseline, just remove first directory level + $filenames[0] =~ s{^.*?/}{}; + print "-> $filenames[0]\n"; + return $filenames[0]; + } foreach my $F (@filenames) { my ($Vol, $Dir, $File) = File::Spec->splitpath($F); my @x = File::Spec->splitdir( $Dir ); @@ -6506,7 +7870,7 @@ #print "F=$F, Dir=$Dir x=[", join("][", @x), "]\n"; push @D, [ @x ]; } - + # now loop over columns until either they are all # eliminated or a unique column is found @@ -6517,7 +7881,7 @@ my $mismatch = 0; while (!$mismatch) { for (my $row = 1; $row < scalar @D; $row++) { -# print "comparing $D[$row][0] to $D[0][0]\n"; +#print "comparing $D[$row][0] to $D[0][0]\n"; if (!defined $D[$row][0] or !defined $D[0][0] or ($D[$row][0] ne $D[0][0])) { @@ -6546,6 +7910,7 @@ $F =~ s{^$leading}{}; } + print "<- remove_leading_dir()\n" if $opt_v > 2; return @filenames; } # 1}}} @@ -6556,22 +7921,35 @@ $ra_removed , # out $ra_compare_list , # out ) = @_; + print "-> align_by_pairs()\n" if $opt_v > 2; @{$ra_compare_list} = (); my @files_L = sort keys %{$rh_file_list_L}; my @files_R = sort keys %{$rh_file_list_R}; - return () unless @files_L and @files_R; + return () unless @files_L or @files_R; # at least one must have stuff + if ( @files_L and !@files_R) { + # left side has stuff, right side is empty; everything deleted + @{$ra_added } = (); + @{$ra_removed } = @files_L; + @{$ra_compare_list} = (); + return; + } elsif (!@files_L and @files_R) { + # left side is empty, right side has stuff; everything added + @{$ra_added } = @files_R; + @{$ra_removed } = (); + @{$ra_compare_list} = (); + return; + } #use Data::Dumper::Simple; #print Dumper("align_by_pairs", @files_L, @files_R); #die; - if (scalar @files_L == 1 or scalar @files_R == 1) { + if (scalar @files_L == 1 and scalar @files_R == 1) { # The easy case: compare two files. push @{$ra_compare_list}, [ $files_L[0], $files_R[0] ]; @{$ra_added } = (); @{$ra_removed} = (); return; } - # The harder case: compare groups of files. This only works # if the groups are in different directories so the first step # is to strip the leading directory names from file lists to @@ -6614,6 +7992,7 @@ @{$ra_added } = keys %added ; @{$ra_removed } = keys %deleted; + print "<- align_by_pairs()\n" if $opt_v > 2; return; #print Dumper("align_by_pairs", @files_L_minus_dir, @files_R_minus_dir); #die; @@ -6676,7 +8055,8 @@ my ($lang, $option_name) = @_; die "Unknown language '$lang' used with $option_name option. " . "The command\n $script --show-lang\n" . - "will print all recognized languages.\n" ; + "will print all recognized languages. Language names are " . + "case sensitive.\n" ; } # 1}}} sub unicode_file { # {{{1 my $file = shift @_; @@ -6705,65 +8085,79 @@ sub unicode_to_ascii { # {{{1 my $string = shift @_; - # A trivial attempt to convert Microsoft Windows style Unicode + # A trivial attempt to convert UTF-16 little or big endian # files into ASCII. These files exhibit the following byte # sequence: - # byte 1: 255 - # byte 2: 254 - # byte 3: ord of ASCII character - # byte 4: 0 - # byte 3+i: ord of ASCII character - # byte 4+i: 0 + # byte 1: 255 + # byte 2: 254 + # byte 3: ord of ASCII character + # byte 4: 0 + # byte 3+i: ord of ASCII character + # byte 4+i: 0 + # or + # byte 1: 255 + # byte 2: 254 + # byte 3: 0 + # byte 4: ord of ASCII character + # byte 3+i: 0 + # byte 4+i: ord of ASCII character + + my $length = length $string; +#print "length=$length\n"; + return '' if $length <= 3; + my @unicode = split(//, $string); + + # check the first 100 characters for big or little endian UTF-16 encoding + my $max_peek = $length < 200 ? $length : 200; + my @view_1 = (); + for (my $i = 2; $i < $max_peek; $i += 2) { push @view_1, $unicode[$i] } + my @view_2 = (); + for (my $i = 3; $i < $max_peek; $i += 2) { push @view_2, $unicode[$i] } + + my $points_1 = 0; + foreach my $C (@view_1) { + ++$points_1 if (32 <= ord($C) and ord($C) <= 127) or ord($C) == 13 + or ord($C) == 10 + or ord($C) == 9; + } + + my $points_2 = 0; + foreach my $C (@view_2) { + ++$points_2 if (32 <= ord($C) and ord($C) <= 127) or ord($C) == 13 + or ord($C) == 10 + or ord($C) == 9; + } +#print "points 1: $points_1\n"; +#print "points 2: $points_2\n"; + + my $offset = undef; + if ($points_1 > 90) { $offset = 2; } + elsif ($points_2 > 90) { $offset = 3; } + else { return '' } # neither big or little endian UTF-16 my @ascii = (); - my $looks_like_unicode = 1; - my $length = length $string; -# print "length=$length\n"; - if ($length <= 3) { - $looks_like_unicode = 0; - return ''; - } - my @unicode = split(//, $string); - - for (my $i = 2; $i < $length; $i += 2) { -# print "examining [$unicode[$i]] ord ", ord($unicode[$i]), "\n"; - if (32 <= ord($unicode[$i]) and ord($unicode[$i]) <= 127 - or ord($unicode[$i]) == 13 - or ord($unicode[$i]) == 10 - or ord($unicode[$i]) == 9 - ) { - push @ascii, $unicode[$i]; -# print "adding [$unicode[$i]]\n"; - } else { - $looks_like_unicode = 0; - last; - } - if ($i+1 < $length) { - if (!$unicode[$i+1]) { - $looks_like_unicode = 0; - last; - } - } - } - if ($looks_like_unicode) { - return join("", @ascii); - } else { - return ''; - } + for (my $i = $offset; $i < $length; $i += 2) { push @ascii, $unicode[$i]; } + return join("", @ascii); } # 1}}} sub uncompress_archive_cmd { # {{{1 my ($archive_file, ) = @_; + # Wrap $archive_file in single or double quotes in the system + # commands below to avoid filename chicanery (including + # spaces in the names). + print "-> uncompress_archive_cmd($archive_file)\n" if $opt_v > 2; my $extract_cmd = ""; my $missing = ""; if ($opt_extract_with) { ( $extract_cmd = $opt_extract_with ) =~ s/>FILE -"; } elsif (($archive_file =~ /\.tar\.(gz|Z)$/ or $archive_file =~ /\.tgz$/ ) and !$ON_WINDOWS) { if (external_utility_exists("gzip --version")) { if (external_utility_exists("tar --version")) { - $extract_cmd = "gzip -dc $archive_file | tar xf -"; + $extract_cmd = "gzip -dc '$archive_file' | tar xf -"; } else { $missing = "tar"; } @@ -6773,7 +8167,17 @@ } elsif ($archive_file =~ /\.tar\.bz2$/ and !$ON_WINDOWS) { if (external_utility_exists("bzip2 --help")) { if (external_utility_exists("tar --version")) { - $extract_cmd = "bzip2 -dc $archive_file | tar xf -"; + $extract_cmd = "bzip2 -dc '$archive_file' | tar xf -"; + } else { + $missing = "tar"; + } + } else { + $missing = "bzip2"; + } + } elsif ($archive_file =~ /\.tar\.xz$/ and !$ON_WINDOWS) { + if (external_utility_exists("unxz --version")) { + if (external_utility_exists("tar --version")) { + $extract_cmd = "unxz -dc '$archive_file' | tar xf -"; } else { $missing = "tar"; } @@ -6781,11 +8185,11 @@ $missing = "bzip2"; } } elsif ($archive_file =~ /\.tar$/ and !$ON_WINDOWS) { - $extract_cmd = "tar xf $archive_file"; + $extract_cmd = "tar xf '$archive_file'"; } elsif ($archive_file =~ /\.src\.rpm$/i and !$ON_WINDOWS) { if (external_utility_exists("cpio --version")) { if (external_utility_exists("rpm2cpio")) { - $extract_cmd = "rpm2cpio $archive_file | cpio -i"; + $extract_cmd = "rpm2cpio '$archive_file' | cpio -i"; } else { $missing = "rpm2cpio"; } @@ -6794,7 +8198,7 @@ } } elsif ($archive_file =~ /\.zip$/i and !$ON_WINDOWS) { if (external_utility_exists("unzip")) { - $extract_cmd = "unzip -qq -d . $archive_file"; + $extract_cmd = "unzip -qq -d . '$archive_file'"; } else { $missing = "unzip"; } @@ -6803,7 +8207,7 @@ $extract_cmd = ""; my $WinZip = '"C:\\Program Files\\WinZip\\WinZip32.exe"'; if (external_utility_exists($WinZip)) { - $extract_cmd = "$WinZip -e -o $archive_file ."; + $extract_cmd = "$WinZip -e -o \"$archive_file\" ."; #print "trace 5 extract_cmd=[$extract_cmd]\n"; } else { #print "trace 6\n"; @@ -6848,9 +8252,9 @@ if ($ON_WINDOWS) { $success = 1 unless system $exe . ' > nul'; } else { - $success = 1 unless system $exe . ' >& /dev/null'; + $success = 1 unless system $exe . ' >/dev/null 2>&1'; if (!$success) { - $success = 1 unless system "which" . " $exe" . ' >& /dev/null'; + $success = 1 unless system "which" . " $exe" . ' >/dev/null 2>&1'; } } @@ -6862,9 +8266,11 @@ warn "Unable to write $CLOC_XSL $!\n"; return; } -my $XSL = <<'EOCommon'; # {{{2 - - + my $XSL = # {{{2 +' + @@ -6893,7 +8299,66 @@

- +'; +# 2}}} + + if ($opt_by_file) { + $XSL .= #
{{{2 +' + + + + + + + +'; + $XSL .= +' + +' if $opt_3; + $XSL .= +' + + + + + + + + + +'; + $XSL .= +' + +' if $opt_3; + $XSL .= +' + + + + + + + +'; + $XSL .= +' + +' if $opt_3; + $XSL .= +' + +
FileBlankCommentCodeLanguage3rd Generation EquivalentScale
Total
+
+'; +# 2}}} + } + + if (!$opt_by_file or $opt_by_file_by_lang) { + $XSL .= #
{{{2 +' @@ -6901,9 +8366,13 @@ - +'; + $XSL .= +' - +' if $opt_3; + $XSL .= +' @@ -6913,9 +8382,13 @@ - +'; + $XSL .= +' - +' if $opt_3; + $XSL .= +' @@ -6923,20 +8396,278 @@ - +'; + $XSL .= +' - +' if $opt_3; + $XSL .= +'
LanguageBlank Comment CodeScaleScale 3rd Generation Equivalent
Total
+'; +# 2}}} + } + + $XSL.= <<'EO_XSL'; # {{{2
- -EOCommon +EO_XSL # 2}}} - print $OUT $XSL; + + my $XSL_DIFF = <<'EO_DIFF_XSL'; # {{{2 + + + + + + + + CLOC Results + + + +

+EO_DIFF_XSL +# 2}}} + + if ($opt_by_file) { + $XSL_DIFF.= <<'EO_DIFF_XSL'; # {{{2 + + + + + + + + + + + + + + + + + + + + + +
Same
FileBlankCommentCode
+ + + + + + + + + + + + + + + + + + + + + + +
Modified
FileBlankCommentCode
+ + + + + + + + + + + + + + + + + + + + + + +
Added
FileBlankCommentCode
+ + + + + + + + + + + + + + + + + + + + + + +
Removed
FileBlankCommentCode
+EO_DIFF_XSL +# 2}}} + } + + if (!$opt_by_file or $opt_by_file_by_lang) { + $XSL_DIFF.= <<'EO_DIFF_XSL'; # {{{2 + + + + + + + + + + + + + + + + + + + + + + + +
Same
LanguageFilesBlankCommentCode
+ + + + + + + + + + + + + + + + + + + + + + + + +
Modified
LanguageFilesBlankCommentCode
+ + + + + + + + + + + + + + + + + + + + + + + + +
Added
LanguageFilesBlankCommentCode
+ + + + + + + + + + + + + + + + + + + + + + + + +
Removed
LanguageFilesBlankCommentCode
+EO_DIFF_XSL +# 2}}} + + } + + $XSL_DIFF.= <<'EO_DIFF_XSL'; # {{{2 + + +
+
+EO_DIFF_XSL +# 2}}} + if ($opt_diff) { + print $OUT $XSL_DIFF; + } else { + print $OUT $XSL; + } $OUT->close(); } # 1}}} sub normalize_file_names { # {{{1 @@ -6969,10 +8700,94 @@ } return %normalized; } # 1}}} +sub combine_diffs { # {{{1 + # subroutine by Andy (awalshe@sf.net) + # https://sourceforge.net/tracker/?func=detail&aid=3261017&group_id=174787&atid=870625 + my ($ra_files) = @_; + + my $res = "$URL v $VERSION\n"; + my $dl = '-'; + my $width = 79; + # columns are in this order + my @cols = ('files', 'blank', 'comment', 'code'); + my %HoH = (); + + foreach my $file (@{$ra_files}) { + my $IN = new IO::File $file, "r"; + if (!defined $IN) { + warn "Unable to read $file; ignoring.\n"; + next; + } + + my $sec; + while (<$IN>) { + next if /^(http|Language|-----)/; + if (/^[A-Za-z0-9]+/) { # section title + $sec = $_; + chomp($sec); + $HoH{$sec} = () if ! exists $HoH{$sec}; + next; + } + + if (/^\s(same|modified|added|removed)/) { # calculated totals row + my @ar = grep { $_ ne '' } split(/ /, $_); + chomp(@ar); + my $ttl = shift @ar; + my $i = 0; + foreach(@ar) { + my $t = "$ttl$dl$cols[$i]"; + $HoH{$sec}{$t} = 0 if ! exists $HoH{$sec}{$t}; + $HoH{$sec}{$t} += $_; + $i++; + } + } + } + $IN->close; + } + + # rows are in this order + my @rows = ('same', 'modified', 'added', 'removed'); + + $res .= sprintf("%s\n", "-" x $width); + $res .= sprintf("%-19s %14s %14s %14s %14s\n", 'Language', + $cols[0], $cols[1], $cols[2], $cols[3]); + $res .= sprintf("%s\n", "-" x $width); + + for my $sec ( keys %HoH ) { + next if $sec =~ /SUM:/; + $res .= "$sec\n"; + foreach (@rows) { + $res .= sprintf(" %-18s %14s %14s %14s %14s\n", + $_, $HoH{$sec}{"$_$dl$cols[0]"}, + $HoH{$sec}{"$_$dl$cols[1]"}, + $HoH{$sec}{"$_$dl$cols[2]"}, + $HoH{$sec}{"$_$dl$cols[3]"}); + } + } + $res .= sprintf("%s\n", "-" x $width); + my $sec = 'SUM:'; + $res .= "$sec\n"; + foreach (@rows) { + $res .= sprintf(" %-18s %14s %14s %14s %14s\n", + $_, $HoH{$sec}{"$_$dl$cols[0]"}, + $HoH{$sec}{"$_$dl$cols[1]"}, + $HoH{$sec}{"$_$dl$cols[2]"}, + $HoH{$sec}{"$_$dl$cols[3]"}); + } + $res .= sprintf("%s\n", "-" x $width); + + return $res; +} # 1}}} +sub get_time { # {{{1 + if ($HAVE_Time_HiRes) { + return Time::HiRes::time(); + } else { + return time(); + } +} # 1}}} # subroutines copied from SLOCCount my %lex_files = (); # really_is_lex() my %expect_files = (); # really_is_expect() -my %pascal_files = (); # really_is_pascal(), really_is_incpascal() my %php_files = (); # really_is_php() sub really_is_lex { # {{{1 # Given filename, returns TRUE if its contents really is lex. @@ -7126,9 +8941,6 @@ my $found_terminating_end = 0; my $has_begin = 0; - # Return cached result, if available: - if ($pascal_files{$filename}) { return pascal_files{$filename};} - open(PASCAL_FILE, "<$filename") || die "Can't open $filename to determine if it's pascal.\n"; while() { @@ -7163,8 +8975,6 @@ ( $has_program && $has_begin && $found_terminating_end ) ) {$is_pascal = 1;} - $pascal_files{$filename} = $is_pascal; # Store result in cache. - return $is_pascal; } # 1}}} sub really_is_incpascal { # {{{1 @@ -7179,8 +8989,7 @@ # 2. Any usual reserverd word is found (program, unit, const, begin...) # If the general routine for Pascal files works, we have it - if (&really_is_pascal ($filename)) { - $pascal_files{$filename} = 1; + if (really_is_pascal($filename)) { return 1; } @@ -7208,7 +9017,6 @@ } close(PASCAL_FILE); - $pascal_files{$filename} = $is_pascal; # Store result in cache. return $is_pascal; } # 1}}} sub really_is_php { # {{{1 diff -Nru cloc-1.53/cloc.1 cloc-1.60/cloc.1 --- cloc-1.53/cloc.1 1970-01-01 00:00:00.000000000 +0000 +++ cloc-1.60/cloc.1 2013-08-16 21:19:56.000000000 +0000 @@ -0,0 +1,550 @@ +.\" Automatically generated by Pod::Man 2.25 (Pod::Simple 3.16) +.\" +.\" Standard preamble: +.\" ======================================================================== +.de Sp \" Vertical space (when we can't use .PP) +.if t .sp .5v +.if n .sp +.. +.de Vb \" Begin verbatim text +.ft CW +.nf +.ne \\$1 +.. +.de Ve \" End verbatim text +.ft R +.fi +.. +.\" Set up some character translations and predefined strings. \*(-- will +.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left +.\" double quote, and \*(R" will give a right double quote. \*(C+ will +.\" give a nicer C++. Capital omega is used to do unbreakable dashes and +.\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, +.\" nothing in troff, for use with C<>. +.tr \(*W- +.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' +.ie n \{\ +. ds -- \(*W- +. ds PI pi +. if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch +. if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch +. ds L" "" +. ds R" "" +. ds C` "" +. ds C' "" +'br\} +.el\{\ +. ds -- \|\(em\| +. ds PI \(*p +. ds L" `` +. ds R" '' +'br\} +.\" +.\" Escape single quotes in literal strings from groff's Unicode transform. +.ie \n(.g .ds Aq \(aq +.el .ds Aq ' +.\" +.\" If the F register is turned on, we'll generate index entries on stderr for +.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index +.\" entries marked with X<> in POD. Of course, you'll have to process the +.\" output yourself in some meaningful fashion. +.ie \nF \{\ +. de IX +. tm Index:\\$1\t\\n%\t"\\$2" +.. +. nr % 0 +. rr F +.\} +.el \{\ +. de IX +.. +.\} +.\" +.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2). +.\" Fear. Run. Save yourself. No user-serviceable parts. +. \" fudge factors for nroff and troff +.if n \{\ +. ds #H 0 +. ds #V .8m +. ds #F .3m +. ds #[ \f1 +. ds #] \fP +.\} +.if t \{\ +. ds #H ((1u-(\\\\n(.fu%2u))*.13m) +. ds #V .6m +. ds #F 0 +. ds #[ \& +. ds #] \& +.\} +. \" simple accents for nroff and troff +.if n \{\ +. ds ' \& +. ds ` \& +. ds ^ \& +. ds , \& +. ds ~ ~ +. ds / +.\} +.if t \{\ +. ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u" +. ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u' +. ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u' +. ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u' +. ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u' +. ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u' +.\} +. \" troff and (daisy-wheel) nroff accents +.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V' +.ds 8 \h'\*(#H'\(*b\h'-\*(#H' +.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#] +.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H' +.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u' +.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#] +.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#] +.ds ae a\h'-(\w'a'u*4/10)'e +.ds Ae A\h'-(\w'A'u*4/10)'E +. \" corrections for vroff +.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u' +.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u' +. \" for low resolution devices (crt and lpr) +.if \n(.H>23 .if \n(.V>19 \ +\{\ +. ds : e +. ds 8 ss +. ds o a +. ds d- d\h'-1'\(ga +. ds D- D\h'-1'\(hy +. ds th \o'bp' +. ds Th \o'LP' +. ds ae ae +. ds Ae AE +.\} +.rm #[ #] #H #V #F C +.\" ======================================================================== +.\" +.IX Title "CLOC.1 1" +.TH CLOC.1 1 "2013-06-02" "perl v5.14.2" "User Contributed Perl Documentation" +.\" For nroff, turn off justification. Always turn off hyphenation; it makes +.\" way too many mistakes in technical documents. +.if n .ad l +.nh +.SH "NAME" +cloc \- Count, and compute differences of, lines of source code and comments. +.SH "SYNOPSIS" +.IX Header "SYNOPSIS" +.Vb 1 +\& cloc [options] ... +.Ve +.SH "DESCRIPTION" +.IX Header "DESCRIPTION" +Count, or compute differences of, physical lines of source code in the +given files (may be archives such as compressed tarballs or zip files) +and/or recursively below the given directories. It is +written entirely in Perl, using only modules from the standard +distribution. +.SH "OPTIONS" +.IX Header "OPTIONS" +.SS "Input Options" +.IX Subsection "Input Options" +To count standard input, use the special filename \fB\-\fR. +.IP "\fB\-\-extract\-with=CMD\fR" 4 +.IX Item "--extract-with=CMD" +This option is only needed if cloc is unable to figure out how to +extract the contents of the input file(s) by itself. Use \s-1CMD\s0 to +extract binary archive files (e.g.: .tar.gz, .zip, .Z). Use the +literal '>FILE<' as a stand-in for the actual file(s) to be +extracted. For example, to count lines of code in the input files +gcc\-4.2.tar.gz perl\-5.8.8.tar.gz on Unix use: +.Sp +.Vb 1 +\& \-\-extract\-with=\*(Aqgzip \-dc >FILE< | tar xf \- +.Ve +.Sp +or, if you have \s-1GNU\s0 tar: +.Sp +.Vb 1 +\& \-\-extract\-with=\*(Aqtar zxf >FILE<\*(Aq +.Ve +.Sp +and on Windows, use, for example: +.Sp +.Vb 1 +\& \-\-extract\-with="\e"c:\eProgram Files\eWinZip\eWinZip32.exe\e" \-e \-o >FILE< +.Ve +.IP "\fB\-\-list\-file=FILE\fR" 4 +.IX Item "--list-file=FILE" +Take the list of file and/or directory names to process from \s-1FILE\s0 +which has one file/directory name per line. See also +\&\fB\-\-exclude\-list\-file\fR +.IP "\fB\-\-unicode\fR" 4 +.IX Item "--unicode" +Check binary files to see if they contain Unicode expanded \s-1ASCII\s0 text. +This causes performance to drop noticably. +.SS "Processing Options" +.IX Subsection "Processing Options" +.IP "\fB\-\-autoconf\fR" 4 +.IX Item "--autoconf" +Count .in files (as processed by \s-1GNU\s0 autoconf) of recognized languages. +.IP "\fB\-\-by\-file\fR" 4 +.IX Item "--by-file" +Report results for every source file encountered. +.IP "\fB\-\-by\-file\-by\-lang\fR" 4 +.IX Item "--by-file-by-lang" +Report results for every source file encountered in addition to +reporting by language. +.IP "\fB\-\-diff \s-1SET1\s0 \s-1SET2\s0\fR" 4 +.IX Item "--diff SET1 SET2" +Compute differences in code and comments between source file(s) of +\&\s-1SET1\s0 and \s-1SET2\s0. The inputs may be pairs of files, directories, or +archives. Use \fB\-\-diff\-alignment\fR to generate a list showing +which file pairs where compared. See also \fB\-\-ignore\-case\fR, +\&\fB\-\-ignore\-whitespace\fR. +.IP "\fB\-\-diff\-timeout N\fR" 4 +.IX Item "--diff-timeout N" +Ignore files which take more than N seconds +to process. Default is 10 seconds. +(Large files with many repeated lines can cause +\&\fIAlgorithm::Diff::sdiff()\fR to take hours.) +.IP "\fB\-\-follow\-links\fR" 4 +.IX Item "--follow-links" +[Unix only] Follow symbolic links to directories (sym links to files +are always followed). +.IP "\fB\-\-force\-lang=LANG[,EXT]\fR" 4 +.IX Item "--force-lang=LANG[,EXT]" +Process all files that have a \s-1EXT\s0 extension with the counter for +language \s-1LANG\s0. For example, to count all .f files with the Fortran +90 counter (which expects files to end with .f90) instead of the +default Fortran 77 counter, use: +.Sp +.Vb 1 +\& \-\-force\-lang="Fortran 90",f +.Ve +.Sp +If \s-1EXT\s0 is omitted, every file will be counted with the \s-1LANG\s0 counter. +This option can be specified multiple times (but that is only useful +when \s-1EXT\s0 is given each time). See also \fB\-\-script\-lang\fR, +\&\fB\-\-lang\-no\-ext\fR. +.IP "\fB\-\-force\-lang\-def=FILE\fR" 4 +.IX Item "--force-lang-def=FILE" +Load language processing filters from \s-1FILE\s0, +then use these filters instead of the built-in +filters. Note: languages which map to the same +file extension (for example: +MATLAB/Objective C/MUMPS; Pascal/PHP; +Lisp/OpenCL) will be ignored as these require +additional processing that is not expressed in +language definition files. +Use \fB\-\-read\-lang\-def\fR to define new language +filters without replacing built-in filters +(see also \fB\-\-write\-lang\-def\fR). +.IP "\fB\-\-ignore\-whitespace\fR" 4 +.IX Item "--ignore-whitespace" +Ignore horizontal white space when comparing files +with \fB\-\-diff\fR. See also \fB\-\-ignore\-case\fR. +.IP "\fB\-\-ignore\-case\fR" 4 +.IX Item "--ignore-case" +Ignore changes in case; consider upper\- and lowercase letters equivalent +when comparing files with \fB\-\-diff\fR. See also \fB\-\-ignore\-whitespace\fR. +.IP "\fB\-\-lang\-no\-ext=LANG\fR" 4 +.IX Item "--lang-no-ext=LANG" +Count files without extensions using the \s-1LANG\s0 counter. This option +overrides internal logic for files without extensions (where such files +are checked against known scripting languages by examining the first +line for \f(CW\*(C`#!\*(C'\fR). See also \fB\-\-force\-lang\fR, \fB\-\-script\-lang\fR. +.IP "\fB\-\-max\-file\-size=MB\fR" 4 +.IX Item "--max-file-size=MB" +Skip files larger than \f(CW\*(C`MB\*(C'\fR megabytes when +traversing directories. By default, \f(CW\*(C`MB\*(C'\fR=100. +cloc's memory requirement is roughly twenty times +larger than the largest file so running with +files larger than 100 \s-1MB\s0 on a computer with less +than 2 \s-1GB\s0 of memory will cause problems. +Note: this check does not apply to files +explicitly passed as command line arguments. +.IP "\fB\-\-read\-binary\-files\fR" 4 +.IX Item "--read-binary-files" +Process binary files in addition to text files. This is usually a bad +idea and should only be attempted with text files that have embedded +binary data. +.IP "\fB\-\-read\-lang\-def=FILE\fR" 4 +.IX Item "--read-lang-def=FILE" +Load new language processing filters from \s-1FILE\s0 +and merge them with those +already known to cloc. If \s-1FILE\s0 defines a +language cloc already knows about, cloc's +definition will take precedence. Use +\&\fB\-\-force\-lang\-def\fR to over-ride cloc's definitions. +(see also \fB\-\-write\-lang\-def\fR). +.IP "\fB\-\-script\-lang=LANG,S\fR" 4 +.IX Item "--script-lang=LANG,S" +Process all files that invoke \f(CW\*(C`S\*(C'\fR as a \f(CW\*(C`#!\*(C'\fR scripting language with the +counter for language \s-1LANG\s0. For example, files that begin with +\&\f(CW\*(C`#!/usr/local/bin/perl5.8.8\*(C'\fR will be counted with the Perl counter by +using +.Sp +.Vb 1 +\& \-\-script\-lang=Perl,perl5.8.8 +.Ve +.Sp +The language name is case insensitive but the name of the script +language executable, \f(CW\*(C`S\*(C'\fR, must have the right case. This option can be +specified multiple times. See also \fB\-\-force\-lang\fR. +.IP "\fB\-\-sdir=DIR\fR" 4 +.IX Item "--sdir=DIR" +Use \s-1DIR\s0 as the scratch directory instead of letting \fIFile::Temp\fR chose +the location. Files written to this location are not removed at the +end of the run (as they are with \fIFile::Temp\fR). +.IP "\fB\-\-skip\-uniqueness\fR" 4 +.IX Item "--skip-uniqueness" +Skip the file uniqueness check. This will give a performance boost at +the expense of counting files with identical contents multiple times +(if such duplicates exist). +.IP "\fB\-\-stdin\-name=FILE\fR" 4 +.IX Item "--stdin-name=FILE" +Count lines streamed via \fI\s-1STDIN\s0\fR as if they came from a file named \s-1FILE\s0. +.IP "\fB\-\-strip\-comments=EXT\fR" 4 +.IX Item "--strip-comments=EXT" +For each file processed, write to the current directory a version of +the file which has blank lines and comments removed. The name of each +stripped file is the original file name with \f(CW\*(C`.EXT\*(C'\fR appended to it. +It is written to the current directory unless \fB\-\-original\-dir\fR is on. +.IP "\fB\-\-original\-dir\fR" 4 +.IX Item "--original-dir" +Write the stripped files the same directory as the original files. +Only effective in combination with \fB\-\-strip\-comments\fR. +.IP "\fB\-\-sum\-reports\fR" 4 +.IX Item "--sum-reports" +Input arguments are report files previously created with the +\&\fB\-\-report\-file\fR option. Makes a cumulative set of results containing +the sum of data from the individual report files. +.IP "\fB\-\-unix\fR" 4 +.IX Item "--unix" +Over-ride the operating system detection logic and run in \s-1UNIX\s0 +mode. See also \fB\-\-windows\fR, \fB\-\-show\-os\fR. +.IP "\fB\-\-windows\fR" 4 +.IX Item "--windows" +Over-ride the operating system detection logic and run in +Microsoft Windows mode. See also \fB\-\-unix\fR, \fB\-\-show\-os\fR. +.SS "Filter Options" +.IX Subsection "Filter Options" +.IP "\fB\-\-exclude\-dir= ...]>" 4 +.IX Item "--exclude-dir= ...]>" +Exclude the given comma separated directories from being scanned. For +example: +.Sp +.Vb 1 +\& \-\-exclude\-dir=.cache,test +.Ve +.Sp +will skip all files that match \f(CW\*(C`/.cache/\*(C'\fR or \f(CW\*(C`/test/\*(C'\fR as part of +their path. Directories named \f(CW\*(C`.bzr\*(C'\fR, \f(CW\*(C`.cvs\*(C'\fR, \f(CW\*(C`.hg\*(C'\fR, \f(CW\*(C`.git\*(C'\fR, +\&\f(CW\*(C`.hg\*(C'\fR, and \f(CW\*(C`.svn\*(C'\fR are always excluded. +.IP "\fB\-\-exclude\-ext=EXT1[,EXT2 ...]\fR" 4 +.IX Item "--exclude-ext=EXT1[,EXT2 ...]" +Do not count files having the given file name extensions. +.IP "\fB\-\-exclude\-lang= ...]>" 4 +.IX Item "--exclude-lang= ...]>" +Exclude the given comma separated languages from being counted. +.IP "\fB\-\-exclude\-list\-file=FILE\fR" 4 +.IX Item "--exclude-list-file=FILE" +Ignore files whose names appear in \s-1FILE\s0. \s-1FILE\s0 should have one entry +per line. Relative path names will be resolved starting from the +directory where cloc is invoked. See also \fB\-\-list\-file\fR. +.IP "\fB\-\-match\-d=REGEX\fR" 4 +.IX Item "--match-d=REGEX" +Only count files in directories matching the Perl regex. For example +.Sp +.Vb 1 +\& \-\-match\-d=\*(Aq/(src|include)/\*(Aq +.Ve +.Sp +only counts files in directory paths containing \f(CW\*(C`/src/\*(C'\fR +or \f(CW\*(C`/include/\*(C'\fR. +.IP "\fB\-\-not\-match\-d=REGEX\fR" 4 +.IX Item "--not-match-d=REGEX" +Count all files except in directories matching the Perl regex. +.IP "\fB\-\-match\-f=REGEX\fR" 4 +.IX Item "--match-f=REGEX" +Only count files whose basenames match the Perl regex. For example +this only counts files at start with Widget or widget: +.Sp +.Vb 1 +\& \-\-match\-f=\*(Aq^[Ww]idget\*(Aq +.Ve +.IP "\fB\-\-not\-match\-f=REGEX\fR" 4 +.IX Item "--not-match-f=REGEX" +Count all files except those whose basenames match the Perl regex. +.IP "\fB\-\-skip\-archive=REGEX\fR" 4 +.IX Item "--skip-archive=REGEX" +Ignore files that end with the given Perl regular +expression. For example, if given + \-\-skip\-archive='(zip|tar(\e.(gz|Z|bz2|xz|7z))?)' +the code will skip files that end with .zip, +\&.tar, .tar.gz, .tar.Z, .tar.bz2, .tar.xz, and +\&.tar.7z. +.IP "\fB\-\-skip\-win\-hidden\fR" 4 +.IX Item "--skip-win-hidden" +On Windows, ignore hidden files. +.SS "Debug Options" +.IX Subsection "Debug Options" +.IP "\fB\-\-categorized=FILE\fR" 4 +.IX Item "--categorized=FILE" +Save names of categorized files to \s-1FILE\s0. +.IP "\fB\-\-counted=FILE\fR" 4 +.IX Item "--counted=FILE" +Save names of processed source files to \s-1FILE\s0. +.IP "\fB\-\-diff\-alignment=FILE\fR" 4 +.IX Item "--diff-alignment=FILE" +Write to \s-1FILE\s0 a list of files and file pairs +showing which files were added, removed, and/or +compared during a run with \fB\-\-diff\fR. This switch +forces the \fB\-\-diff\fR mode on. +.IP "\fB\-\-help\fR" 4 +.IX Item "--help" +Print this usage information and exit. +.IP "\fB\-\-found=FILE\fR" 4 +.IX Item "--found=FILE" +Save names of every file found to \s-1FILE\s0. +.IP "\fB\-\-ignored=FILE\fR" 4 +.IX Item "--ignored=FILE" +Save names of ignored files and the reason they were ignored to \s-1FILE\s0. +.IP "\fB\-\-print\-filter\-stages\fR" 4 +.IX Item "--print-filter-stages" +Print to \fI\s-1STDOUT\s0\fR processed source code before and after each filter is +applied. +.IP "\fB\-\-show\-ext[=EXT]\fR" 4 +.IX Item "--show-ext[=EXT]" +Print information about all known (or just the given) file extensions +and exit. +.IP "\fB\-\-show\-lang[=LANG]\fR" 4 +.IX Item "--show-lang[=LANG]" +Print information about all known (or just the given) languages and +exit. +.IP "\fB\-\-show\-os\fR" 4 +.IX Item "--show-os" +Print the value of the operating system mode and exit. See also +\&\fB\-\-unix\fR, \fB\-\-windows\fR. +.IP "\fB\-v[=" 4 +.IX Item "-v[=" +Turn on verbose with optional numeric value. +.IP "\fB\-\-version\fR" 4 +.IX Item "--version" +Print the version of this program and exit. +.IP "\fB\-\-write\-lang\-def=FILE\fR" 4 +.IX Item "--write-lang-def=FILE" +Writes to \s-1FILE\s0 the language processing filters then exits. Useful as a +first step to creating custom language definitions. See also +\&\fB\-\-force\-lang\-def\fR, \fB\-\-read\-lang\-def\fR. +.SS "Output Options" +.IX Subsection "Output Options" +.IP "\fB\-\-3\fR" 4 +.IX Item "--3" +Print third-generation language output. (This option can cause report +summation to fail if some reports were produced with this option while +others were produced without it.) +.IP "\fB\-\-progress\-rate=N\fR" 4 +.IX Item "--progress-rate=N" +Show progress update after every N files are processed (default +N=100). Set N to 0 to suppress progress output; useful when +redirecting output to \fI\s-1STDOUT\s0\fR. +.IP "\fB\-\-quiet\fR" 4 +.IX Item "--quiet" +Suppress all information messages except for the final report. +.IP "\fB\-\-report\-file=FILE\fR" 4 +.IX Item "--report-file=FILE" +Write the results to \s-1FILE\s0 instead of standard output. +.IP "\fB\-\-out=FILE\fR" 4 +.IX Item "--out=FILE" +Synonym for \fB\-\-report\-file=FILE\fR. +.IP "\fB\-\-csv\fR" 4 +.IX Item "--csv" +Write the results as comma separated values. +.IP "\fB\-\-csv\-delimiter=C\fR" 4 +.IX Item "--csv-delimiter=C" +Use the character C as the delimiter for comma separated files +instead of ,. This switch forces \fB\-\-csv\fR to be on. +.IP "\fB\-\-sql=FILE\fR" 4 +.IX Item "--sql=FILE" +Write results as \s-1SQL\s0 \s-1CREATE\s0 and \s-1INSERT\s0 statements which can be read by +a database program such as SQLite. If \s-1FILE\s0 is \fB\-\fR, output is sent to +\&\fI\s-1STDOUT\s0\fR. +.IP "\fB\-\-sql\-project=NAME\fR" 4 +.IX Item "--sql-project=NAME" +Use as the project identifier for the current run. Only valid +with the \fB\-\-sql\fR option. +.IP "\fB\-\-sql\-append\fR" 4 +.IX Item "--sql-append" +Append \s-1SQL\s0 insert statements to the file specified by \fB\-\-sql\fR and +do not generate table creation option. +.IP "\fB\-\-sum\-one\fR" 4 +.IX Item "--sum-one" +For plain text reports, show the \s-1SUM:\s0 output line even if only +one input file is processed. +.IP "\fB\-\-xml\fR" 4 +.IX Item "--xml" +Write the results in \s-1XML\s0. +.IP "\fB\-\-xsl[=FILE]\fR" 4 +.IX Item "--xsl[=FILE]" +Reference \s-1FILE\s0 as an \s-1XSL\s0 stylesheet within the \s-1XML\s0 output. If \s-1FILE\s0 is +not given, writes a default stylesheet, cloc.xsl. This switch forces +\&\fB\-\-xml\fR to be on. +.IP "\fB\-\-yaml\fR" 4 +.IX Item "--yaml" +Write the results in \s-1YAML\s0. +.SH "EXAMPLES" +.IX Header "EXAMPLES" +Count the lines of code in the Perl 5.10.0 compressed tar file +on a UNIX-like operating system: +.PP +.Vb 1 +\& cloc perl\-5.10.0.tar.gz +.Ve +.PP +Count the changes in files, code, and comments between Python +releases 2.6.6 and 2.7: +.PP +.Vb 1 +\& cloc \-\-diff Python\-2.6.6.tar.bz Python\-2.7.tar.bz2 +.Ve +.PP +To see how cloc aligns files for comparison between two code +bases, use the \fB\-\-diff\-alignment=FILE\fR option. Here the +alignment information is written to \f(CW\*(C`align.txt\*(C'\fR: +.PP +.Vb 1 +\& cloc \-\-diff\-aligment=align.txt gcc\-4.4.0.tar.bz2 gcc\-4.5.0.tar.bz2 +.Ve +.PP +Print the recognized languages +.PP +.Vb 1 +\& cloc \-\-show\-lang +.Ve +.PP +Remove comments from \f(CW\*(C`foo.c\*(C'\fR and save the result in \f(CW\*(C`foo.c.nc\*(C'\fR +.PP +.Vb 1 +\& cloc \-\-strip\-comments=nc foo.c +.Ve +.PP +Additional examples can be found at . +.SH "ENVIRONMENT" +.IX Header "ENVIRONMENT" +None. +.SH "FILES" +.IX Header "FILES" +None. +.SH "SEE ALSO" +.IX Header "SEE ALSO" +\&\fIsloccount\fR\|(1) +.SH "AUTHORS" +.IX Header "AUTHORS" +The cloc program was written by Al Danial and +is Copyright (C) 2006\-2013 Northrop Grumman Corporation. +.PP +The manual page was originally written by Jari Aalto . +.PP +Both the code and documentation is released under the \s-1GNU\s0 \s-1GPL\s0 version 2 +or (at your option) any later version. For more information about +license, visit . diff -Nru cloc-1.53/cloc.1.pod cloc-1.60/cloc.1.pod --- cloc-1.53/cloc.1.pod 1970-01-01 00:00:00.000000000 +0000 +++ cloc-1.60/cloc.1.pod 2013-08-16 21:19:56.000000000 +0000 @@ -0,0 +1,526 @@ +# Copyright +# +# Copyright (C) 2013 Al Danial . +# Copyright (C) 2010-2013 Jari Aalto +# +# License +# +# 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, see . +# +# Description +# +# To learn what TOP LEVEL section to use in manual pages, +# see POSIX/Susv standard and "Utility Description Defaults" at +# http://www.opengroup.org/onlinepubs/009695399/utilities/xcu_chap01.html#tag_01_11 +# +# This is manual page in Perl POD format. Read more at +# http://perldoc.perl.org/perlpod.html or run command: +# +# perldoc perlpod | less +# +# To check the syntax: +# +# podchecker *.pod +# +# Create manual page with command: +# +# pod2man PAGE.N.pod > PAGE.N + +=pod + +=head1 NAME + +cloc - Count, and compute differences of, lines of source code and comments. + +=head1 SYNOPSIS + + cloc [options] ... + +=head1 DESCRIPTION + +Count, or compute differences of, physical lines of source code in the +given files (may be archives such as compressed tarballs or zip files) +and/or recursively below the given directories. It is +written entirely in Perl, using only modules from the standard +distribution. + +=head1 OPTIONS + +=head2 Input Options + +To count standard input, use the special filename B<->. + +=over 4 + +=item B<--extract-with=CMD> + +This option is only needed if cloc is unable to figure out how to +extract the contents of the input file(s) by itself. Use CMD to +extract binary archive files (e.g.: .tar.gz, .zip, .Z). Use the +literal 'EFILEE' as a stand-in for the actual file(s) to be +extracted. For example, to count lines of code in the input files +gcc-4.2.tar.gz perl-5.8.8.tar.gz on Unix use: + + --extract-with='gzip -dc >FILE< | tar xf - + +or, if you have GNU tar: + + --extract-with='tar zxf >FILE<' + +and on Windows, use, for example: + + --extract-with="\"c:\Program Files\WinZip\WinZip32.exe\" -e -o >FILE< + +=item B<--list-file=FILE> + +Take the list of file and/or directory names to process from FILE +which has one file/directory name per line. See also +B<--exclude-list-file> + +=item B<--unicode> + +Check binary files to see if they contain Unicode expanded ASCII text. +This causes performance to drop noticably. + +=back + +=head2 Processing Options + +=over 4 + +=item B<--autoconf> + +Count .in files (as processed by GNU autoconf) of recognized languages. + +=item B<--by-file> + +Report results for every source file encountered. + +=item B<--by-file-by-lang> + +Report results for every source file encountered in addition to +reporting by language. + +=item B<--diff SET1 SET2> + +Compute differences in code and comments between source file(s) of +SET1 and SET2. The inputs may be pairs of files, directories, or +archives. Use B<--diff-alignment> to generate a list showing +which file pairs where compared. See also B<--ignore-case>, +B<--ignore-whitespace>. + +=item B<--diff-timeout N> + +Ignore files which take more than N seconds +to process. Default is 10 seconds. +(Large files with many repeated lines can cause +Algorithm::Diff::sdiff() to take hours.) + +=item B<--follow-links> + +[Unix only] Follow symbolic links to directories (sym links to files +are always followed). + +=item B<--force-lang=LANG[,EXT]> + +Process all files that have a EXT extension with the counter for +language LANG. For example, to count all .f files with the Fortran +90 counter (which expects files to end with .f90) instead of the +default Fortran 77 counter, use: + + --force-lang="Fortran 90",f + +If EXT is omitted, every file will be counted with the LANG counter. +This option can be specified multiple times (but that is only useful +when EXT is given each time). See also B<--script-lang>, +B<--lang-no-ext>. + +=item B<--force-lang-def=FILE> + +Load language processing filters from FILE, +then use these filters instead of the built-in +filters. Note: languages which map to the same +file extension (for example: +MATLAB/Objective C/MUMPS; Pascal/PHP; +Lisp/OpenCL) will be ignored as these require +additional processing that is not expressed in +language definition files. +Use B<--read-lang-def> to define new language +filters without replacing built-in filters +(see also B<--write-lang-def>). + +=item B<--ignore-whitespace> + +Ignore horizontal white space when comparing files +with B<--diff>. See also B<--ignore-case>. + +=item B<--ignore-case> + +Ignore changes in case; consider upper- and lowercase letters equivalent +when comparing files with B<--diff>. See also B<--ignore-whitespace>. + +=item B<--lang-no-ext=LANG> + +Count files without extensions using the LANG counter. This option +overrides internal logic for files without extensions (where such files +are checked against known scripting languages by examining the first +line for C<#!>). See also B<--force-lang>, B<--script-lang>. + +=item B<--max-file-size=MB> + +Skip files larger than C megabytes when +traversing directories. By default, C=100. +cloc's memory requirement is roughly twenty times +larger than the largest file so running with +files larger than 100 MB on a computer with less +than 2 GB of memory will cause problems. +Note: this check does not apply to files +explicitly passed as command line arguments. + +=item B<--read-binary-files> + +Process binary files in addition to text files. This is usually a bad +idea and should only be attempted with text files that have embedded +binary data. + +=item B<--read-lang-def=FILE> + +Load new language processing filters from FILE +and merge them with those +already known to cloc. If FILE defines a +language cloc already knows about, cloc's +definition will take precedence. Use +B<--force-lang-def> to over-ride cloc's definitions. +(see also B<--write-lang-def>). + +=item B<--script-lang=LANG,S> + +Process all files that invoke C as a C<#!> scripting language with the +counter for language LANG. For example, files that begin with +C<#!/usr/local/bin/perl5.8.8> will be counted with the Perl counter by +using + + --script-lang=Perl,perl5.8.8 + +The language name is case insensitive but the name of the script +language executable, C, must have the right case. This option can be +specified multiple times. See also B<--force-lang>. + +=item B<--sdir=DIR> + +Use DIR as the scratch directory instead of letting I chose +the location. Files written to this location are not removed at the +end of the run (as they are with I). + +=item B<--skip-uniqueness> + +Skip the file uniqueness check. This will give a performance boost at +the expense of counting files with identical contents multiple times +(if such duplicates exist). + +=item B<--stdin-name=FILE> + +Count lines streamed via I as if they came from a file named FILE. + +=item B<--strip-comments=EXT> + +For each file processed, write to the current directory a version of +the file which has blank lines and comments removed. The name of each +stripped file is the original file name with C<.EXT> appended to it. +It is written to the current directory unless B<--original-dir> is on. + +=item B<--original-dir> + +Write the stripped files the same directory as the original files. +Only effective in combination with B<--strip-comments>. + +=item B<--sum-reports> + +Input arguments are report files previously created with the +B<--report-file> option. Makes a cumulative set of results containing +the sum of data from the individual report files. + +=item B<--unix> + +Over-ride the operating system detection logic and run in UNIX +mode. See also B<--windows>, B<--show-os>. + +=item B<--windows> + +Over-ride the operating system detection logic and run in +Microsoft Windows mode. See also B<--unix>, B<--show-os>. + +=back + +=head2 Filter Options + +=over 4 + +=item B<--exclude-dir=[, ...]> + +Exclude the given comma separated directories from being scanned. For +example: + + --exclude-dir=.cache,test + +will skip all files that match C or C as part of +their path. Directories named C<.bzr>, C<.cvs>, C<.hg>, C<.git>, +C<.hg>, and C<.svn> are always excluded. + +=item B<--exclude-ext=EXT1[,EXT2 ...]> + +Do not count files having the given file name extensions. + +=item B<--exclude-lang=[, ...]> + +Exclude the given comma separated languages from being counted. + +=item B<--exclude-list-file=FILE> + +Ignore files whose names appear in FILE. FILE should have one entry +per line. Relative path names will be resolved starting from the +directory where cloc is invoked. See also B<--list-file>. + +=item B<--match-d=REGEX> + +Only count files in directories matching the Perl regex. For example + + --match-d='/(src|include)/' + +only counts files in directory paths containing C +or C. + +=item B<--not-match-d=REGEX> + +Count all files except in directories matching the Perl regex. + +=item B<--match-f=REGEX> + +Only count files whose basenames match the Perl regex. For example +this only counts files at start with Widget or widget: + + --match-f='^[Ww]idget' + +=item B<--not-match-f=REGEX> + +Count all files except those whose basenames match the Perl regex. + +=item B<--skip-archive=REGEX> + +Ignore files that end with the given Perl regular +expression. For example, if given + --skip-archive='(zip|tar(\.(gz|Z|bz2|xz|7z))?)' +the code will skip files that end with .zip, +.tar, .tar.gz, .tar.Z, .tar.bz2, .tar.xz, and +.tar.7z. + +=item B<--skip-win-hidden> + +On Windows, ignore hidden files. + +=back + +=head2 Debug Options + +=over 4 + +=item B<--categorized=FILE> + +Save names of categorized files to FILE. + +=item B<--counted=FILE> + +Save names of processed source files to FILE. + +=item B<--diff-alignment=FILE> + +Write to FILE a list of files and file pairs +showing which files were added, removed, and/or +compared during a run with B<--diff>. This switch +forces the B<--diff> mode on. + +=item B<--help> + +Print this usage information and exit. + +=item B<--found=FILE> + +Save names of every file found to FILE. + +=item B<--ignored=FILE> + +Save names of ignored files and the reason they were ignored to FILE. + +=item B<--print-filter-stages> + +Print to I processed source code before and after each filter is +applied. + +=item B<--show-ext[=EXT]> + +Print information about all known (or just the given) file extensions +and exit. + +=item B<--show-lang[=LANG]> + +Print information about all known (or just the given) languages and +exit. + +=item B<--show-os> + +Print the value of the operating system mode and exit. See also +B<--unix>, B<--windows>. + +=item B<-v[=]> + +Turn on verbose with optional numeric value. + +=item B<--version> + +Print the version of this program and exit. + +=item B<--write-lang-def=FILE> + +Writes to FILE the language processing filters then exits. Useful as a +first step to creating custom language definitions. See also +B<--force-lang-def>, B<--read-lang-def>. + +=back + +=head2 Output Options + +=over 4 + +=item B<--3> + +Print third-generation language output. (This option can cause report +summation to fail if some reports were produced with this option while +others were produced without it.) + +=item B<--progress-rate=N> + +Show progress update after every N files are processed (default +N=100). Set N to 0 to suppress progress output; useful when +redirecting output to I. + +=item B<--quiet> + +Suppress all information messages except for the final report. + +=item B<--report-file=FILE> + +Write the results to FILE instead of standard output. + +=item B<--out=FILE> + +Synonym for B<--report-file=FILE>. + +=item B<--csv> + +Write the results as comma separated values. + +=item B<--csv-delimiter=C> + +Use the character C as the delimiter for comma separated files +instead of ,. This switch forces B<--csv> to be on. + +=item B<--sql=FILE> + +Write results as SQL CREATE and INSERT statements which can be read by +a database program such as SQLite. If FILE is B<->, output is sent to +I. + +=item B<--sql-project=NAME> + +Use as the project identifier for the current run. Only valid +with the B<--sql> option. + +=item B<--sql-append> + +Append SQL insert statements to the file specified by B<--sql> and +do not generate table creation option. + +=item B<--sum-one> + +For plain text reports, show the SUM: output line even if only +one input file is processed. + +=item B<--xml> + +Write the results in XML. + +=item B<--xsl[=FILE]> + +Reference FILE as an XSL stylesheet within the XML output. If FILE is +not given, writes a default stylesheet, cloc.xsl. This switch forces +B<--xml> to be on. + +=item B<--yaml> + +Write the results in YAML. + +=back + +=head1 EXAMPLES + +Count the lines of code in the Perl 5.10.0 compressed tar file +on a UNIX-like operating system: + + cloc perl-5.10.0.tar.gz + +Count the changes in files, code, and comments between Python +releases 2.6.6 and 2.7: + + cloc --diff Python-2.6.6.tar.bz Python-2.7.tar.bz2 + +To see how cloc aligns files for comparison between two code +bases, use the B<--diff-alignment=FILE> option. Here the +alignment information is written to C: + + cloc --diff-aligment=align.txt gcc-4.4.0.tar.bz2 gcc-4.5.0.tar.bz2 + +Print the recognized languages + + cloc --show-lang + +Remove comments from C and save the result in C + + cloc --strip-comments=nc foo.c + +Additional examples can be found at L. + +=head1 ENVIRONMENT + +None. + +=head1 FILES + +None. + +=head1 SEE ALSO + +sloccount(1) + +=head1 AUTHORS + +The cloc program was written by Al Danial and +is Copyright (C) 2006-2013 Northrop Grumman Corporation. + +The manual page was originally written by Jari Aalto . + +Both the code and documentation is released under the GNU GPL version 2 +or (at your option) any later version. For more information about +license, visit . + +=cut diff -Nru cloc-1.53/debian/changelog cloc-1.60/debian/changelog --- cloc-1.53/debian/changelog 2010-10-11 21:51:46.000000000 +0000 +++ cloc-1.60/debian/changelog 2014-02-14 06:22:14.000000000 +0000 @@ -1,3 +1,80 @@ +cloc (1.60-1~ubuntu12.04.1~ppa1) precise; urgency=low + + * No-change backport to precise + + -- Micah Gersten Fri, 14 Feb 2014 00:22:14 -0600 + +cloc (1.60-1) unstable; urgency=low + + * New upstream release. + * debian/copyright + - Update years. + * debian/rules + - (get-changelog): Update URL. + * debian/upstream.changelog + - Sync with release. + * debian/watch + - Update regexp from *.pl to *.tar.gz. + + -- Jari Aalto Tue, 20 Aug 2013 07:51:51 +0300 + +cloc (1.58-1) unstable; urgency=low + + * New upstream release. + * debian/copyright + - Update year. + * debian/control + - (Standards-Version): 3.9.4. + * debian/{pod2man.mk,cloc.1.pod} + - Delete. Accepted upstream. + * debian/rules + - (man): Remove target. Manual page accepted upstream. + - (override_dh_auto_build): New. + + -- Jari Aalto Fri, 15 Mar 2013 09:16:20 +0200 + +cloc (1.56-1) unstable; urgency=low + + * New upstream release + - Includes fix for: Can't call method "pascal_files" (Closes: #677478). + * debian/control + - (Standards-Version): Update to 3.9.3. + * debian/copyright + - (Format): Point URL to 1.0. + * debian/patches + - Remove 10 (all). Accepted upstream. + * debian/upstream.changelog + - Update from upstream. + + -- Jari Aalto Fri, 15 Jun 2012 10:53:47 +0300 + +cloc (1.55-2) unstable; urgency=low + + * debian/compat + - Update to 9. + * debian/control + - (Build-Depends): debhelper 9. + * debian/patches + - (10): New. Fix perl warning. + + -- Jari Aalto Wed, 15 Feb 2012 16:08:17 -0500 + +cloc (1.55-1) unstable; urgency=low + + * New upstream release. + * debian/control + - (Standards-Version): Update to 3.9.2. + * debian/copyright + - Update to DEP5. + * debian/copyright-update.debhelper.log + - Remove; unnecessary. + * debian/rules + - (get-changelog): Fix typo in sed command. + * debian/upstream.changelog + - Update. + + -- Jari Aalto Wed, 15 Feb 2012 16:06:17 -0500 + cloc (1.53-1) unstable; urgency=low * New upstream release. diff -Nru cloc-1.53/debian/cloc.1.pod cloc-1.60/debian/cloc.1.pod --- cloc-1.53/debian/cloc.1.pod 2010-03-18 10:31:05.000000000 +0000 +++ cloc-1.60/debian/cloc.1.pod 1970-01-01 00:00:00.000000000 +0000 @@ -1,368 +0,0 @@ -# Copyright -# -# Copyright (C) 2009-2010 Jari Aalto -# -# License -# -# 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, see . -# -# Description -# -# To learn what TOP LEVEL section to use in manual pages, -# see POSIX/Susv standard and "tility Description Defaults" at -# http://www.opengroup.org/onlinepubs/009695399/utilities/xcu_chap01.html#tag_01_11 -# -# This is manual page in Perl POD format. Read more at -# http://perldoc.perl.org/perlpod.html or run command: -# -# perldoc perlpod | less -# -# To check the syntax: -# -# podchecker *.pod -# -# Create manual page with command: -# -# pod2man PAGE.N.pod > PAGE.N - -=pod - -=head1 NAME - -cloc - statistics utility to count lines of code - -=head1 SYNOPSIS - - cloc [options] ... - -=head1 DESCRIPTION - -Count physical lines of source code in the given files (may be -archives such as compressed tarballs or zip files) and/or recursively -below the given directories. Counts blank lines, comment lines, and -physical lines of source code in many programming languages. It is -written entirely in Perl, using only modules from the standard -distribution. - -=head1 OPTIONS - -=head2 Input Options - -=over 4 - -=item B<--extract-with=CMD> - -This option is only needed if cloc is unable to figure out how to -extract the contents of the input file(s) by itself. Use to -extract binary archive files (e.g.: .tar.gz, .zip, .Z). Use the -literal 'EFILEE' as a stand-in for the actual file(s) to be -extracted. For example, to count lines of code in the input files -gcc-4.2.tar.gz perl-5.8.8.tar.gz on Unix use: - - --extract-with='gzip -dc >FILE< | tar xf - - -or, if you have GNU tar: - - --extract-with='tar zxf >FILE' - -and on Windows, use: - - --extract-with="\"c:\Program Files\WinZip\WinZip32.exe\" -e -o >FILE< - -=item B<--list-file=FILE> - -Take the list of file and/or directory names to process from FILE - which has one file/directory name per line. See also - B<--exclude-list-file> - -=item B<--unicode> - -Check binary files to see if they contain Unicode expanded ASCII text. -This causes performance to drop noticably. - -=back - -=head2 Processing Options - -=over 4 - -=item B>--by-file> - -Report results for every source file encountered. - -=item B<--by-file-by-lang> - -Report results for every source file encountered in addition to -reporting by language. - -=item B<--force-lang=LANG[,EXT]> - -Process all files that have a EXT extension with the counter for -language LANG. For example, to count all .f files with the Fortran -90 counter (which expects files to end with .f90) instead of the -default Fortran 77 counter, use: - - --force-lang="Fortran 90",f - -If EXT is omitted, every file will be counted with the LANG counter. -This option can be specified multiple times (but that is only useful -when EXT is given each time). See also B<--script-lang>. - -=item B<--read-binary-files> - -Process binary files in addition to text files. This is usually a bad -idea and should only be attempted with text files that have embedded -binary data. - -=item B<--read-lang-def=> - -Load from the language processing filters. (see also ---write-lang-def) then use these filters instead of the built-in -filters. - -=item B<--script-lang=LANG,> - -Process all files that invoke as a C<#!> scripting language with the -counter for language LANG. For example, files that begin with -C<#!/usr/local/bin/perl5.8.8> will be counted with the Perl counter by -using - - --script-lang=Perl,perl5.8.8 - -The language name is case insensitive but the name of the script -language executable, , must have the right case. This option can be -specified multiple times. See also B<--force-lang>. - -=item B<--sdir=DIR> - -Use DIR as the scratch directory instead of letting I chose -the location. Files written to this location are not removed at the -end of the run (as they are with I). - -=item B<--skip-uniqueness> - -Skip the file uniqueness check. This will give a performance boost at -the expense of counting files with identical contents multiple times -(if such duplicates exist). - -=item B<--strip-comments=EXT> - -For each file processed, write to the current directory a version of -the file which has blank lines and comments removed. The name of each -stripped file is the original file name with C<.EXT> appended to it. -It is written to the current directory unless <--original-dir> is on. - -=item B<--original-dir> - -Write the stripped files the same directory as the original files. -Only effective in combination with B<--strip-comments>. - -=item B<--sum-reports> - -Input arguments are report files previously created with the -B<--report-file> option. Makes a cumulative set of results containing -the sum of data from the individual report files. - -=back - -=head2 Filter Options - -=over 4 - -=item B<--exclude-dir=DIR[,DIR ...]> - -Exclude the given comma separated directories from being scanned. For -example: - - --exclude-dir=.cache,test - -will skip all files that match C or C as part of -their path. Directories named C<.cvs> and C<.svn> are always excluded. - -=item B<--exclude-lang=LANG[,LANG ...]> - -Exclude the given comma separated languages from being counted. - -=item B<--exclude-list-file=FILE> - -Ignore files whose names appear in FILE. FILE should have one entry -per line. Relative path names will be resolved starting from the -directory where cloc is invoked. See also B<--list-file>. - -=item B<--match-f=REGEX> - -Only count files whose basenames match the Perl regex. For example -this only counts files at start with Widget or widget: - - --match-f="^[Ww]idge" - -=item B>--not-match-f=REGEX> - -Count all files except those whose basenames match the Perl regex. - -=item B<--skip-win-hidden> - -On Windows, ignore hidden files. - -=back - -=head2 Debug Options - -=over 4 - -=item B<--categorized=FILE> - -Save names of categorized files to FILE. - -=item B<--counted=FILE> - -Save names of processed source files to FILE. - -=item B<--help> - -Print this usage information and exit. - -=item B<--found=FILE> - -Save names of every file found to FILE. - -=item B<--ignored=FILE> - -Save names of ignored files and the reason they were ignored to FILE. - -=item B<--print-filter-stages> - -Print to STDOUT processed source code before and after each filter is -applied. - -=item B<--show-ext[=EXT]> - -Print information about all known (or just the given) file extensions -and exit. - -=item B<--show-lang[=LANG]> - -Print information about all known (or just the given) languages and -exit. - -=item B>-v[=NUMBER]> - -Turn on verbose with optional numeric value. - -=item B<--version> - -Print the version of this program and exit. - -=item B>--write-lang-def=FILE> - -Writes to FILE the language processing filters then exits. Useful as a -first step to creating custom language definitions. See -B<--read-lang-def>. - -=back - -=head2 Output Options - -=over 4 - -=item B<--no3> - -Suppress third-generation language output. This option can cause -report summation to fail f some reports were produced with this option -hile others were produced without it.) - -=item B<--progress-rate=NUMBER> - -Show progress update after every NUMBER files are processed (default -NUMBER=100). Set NUMBER to 0 to suppress progress output; useful when -redirecting output to I. - -=item B<--quiet> - -Suppress all information messages except for the final report. - -=item B<--report-file=FILE> - -Write the results to FILE instead of STDOUT. - -=item B<--out=FILE> - -Synonym for B<--report-file=FILE>. - -=item B<--csv> - -Write the results as comma separated values. - -=item B<--sql=FILE> - -Write results as SQL create and insert statements which can be read by -a database program such as SQLite. If FILE is 1, output is sent to -I. - -=item B<--sql-project=NAME> - -Use NAME as the project identifier for the current run. Only valid -with the B<--sql> option. - -=item B<--sql-append> - -Append SQL insert statements to the file specified -by B<--sql> and do not generate table creation -option. - -=item B<--xml> - -Write the results in XML. - -=item B<--xsl[=FILE]> - -Reference FILE as an XSL stylesheet within the XML output. If FILE is -not given, writes a default stylesheet, cloc.xsl. This switch forces -B<--xml> to be on. - -=item B<--yaml> - -Write the results in YAML. - -=back - -=head1 EXAMPLES - -None (yet). - -=head1 ENVIRONMENT - -None. - -=head1 FILES - -None. - -=head1 SEE ALSO - -sloccount(1) - -=head1 AUTHORS - -Program was written by Al Danial and is -Copyright (C) 2006-2010 Northrop Grumman Corporation, released under -the GNU GPL version 2 or (at your option) any later version. - -This manual page was written by Jari Aalto , for -the Debian GNU system (but may be used by others). Updated by Jari -Aalto . Released under license GNU GPL version 2 -or (at your option) any later version. For more information about -license, visit . - -=cut diff -Nru cloc-1.53/debian/cloc.manpages cloc-1.60/debian/cloc.manpages --- cloc-1.53/debian/cloc.manpages 2010-03-18 10:30:28.000000000 +0000 +++ cloc-1.60/debian/cloc.manpages 1970-01-01 00:00:00.000000000 +0000 @@ -1 +0,0 @@ -debian/*.1 diff -Nru cloc-1.53/debian/compat cloc-1.60/debian/compat --- cloc-1.53/debian/compat 2010-10-11 21:43:24.000000000 +0000 +++ cloc-1.60/debian/compat 2013-08-20 04:52:24.000000000 +0000 @@ -1 +1 @@ -8 +9 diff -Nru cloc-1.53/debian/control cloc-1.60/debian/control --- cloc-1.53/debian/control 2010-10-11 21:43:48.000000000 +0000 +++ cloc-1.60/debian/control 2013-08-20 04:52:24.000000000 +0000 @@ -2,8 +2,8 @@ Section: devel Priority: optional Maintainer: Jari Aalto -Build-Depends: debhelper (>= 8) -Standards-Version: 3.9.1 +Build-Depends: debhelper (>= 9) +Standards-Version: 3.9.4 Vcs-Browser: http://git.debian.org/?p=collab-maint/cloc.git Vcs-Git: git://git.debian.org/git/collab-maint/cloc.git Homepage: http://freshmeat.net/projects/cloc diff -Nru cloc-1.53/debian/copyright cloc-1.60/debian/copyright --- cloc-1.53/debian/copyright 2010-03-18 10:30:28.000000000 +0000 +++ cloc-1.60/debian/copyright 2013-08-20 04:52:24.000000000 +0000 @@ -1,61 +1,107 @@ -This work was packaged for Debian by: - - Jari Aalto - on 2010-02-22 23:02:33+02 Mon. - -It was downloaded from: - - http://freshmeat.net/projects/cloc - -Upstream Author: - - Al Danial +Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0 +Upstream-Name: cloc +Upstream-Contact: + Al Danial , , +Source: http://freshmeat.net/projects/cloc +X-Upstream-Vcs: svn https://cloc.svn.sourceforge.net/svnroot/cloc/trunk/cloc co clock.svn +X-Upstream-Bugs: https://sourceforge.net/tracker/?group_id=174787&atid=870622 +X-Source: http://sourceforge.net/projects/cloc +Files: * Copyright: + 2006-2013 Northrop Grumman Corporation +License: GPL-2+ +X-License-Comment: + [from cloc.pl: contains the following and standard GPL-2+] + . + #!/usr/bin/env perl + # cloc -- Count Lines of Code {{{1 + # Copyright (C) 2006-2011 Northrop Grumman Corporation + # Author: Al Danial + # First release August 2006 + # + # Includes code from: + # - SLOCCount v2.26 + # http://www.dwheeler.com/sloccount/ + # by David Wheeler. + # - Regexp::Common v2.120 + # http://search.cpan.org/~abigail/Regexp-Common-2.120/lib/Regexp/Common.pm + # by Damian Conway and Abigail + # - Win32::Autoglob + # http://search.cpan.org/~sburke/Win32-Autoglob-1.01/Autoglob.pm + # by Sean M. Burke + # - Algorithm::Diff + # http://search.cpan.org/~tyemq/Algorithm-Diff-1.1902/lib/Algorithm/Diff.pm + # by Tye McQueen + . + [Standard GPL-2+ text follows] + . + [For the embedded package Regexp::Common::balanced] + # Copyright (c) 2001 - 2003, Damian Conway. All Rights Reserved. + # This module is free software. It may be used, redistributed + # and/or modified under the terms of the Perl Artistic License + # (see http://www.perl.com/perl/misc/Artistic.html) + . + [For the embedded EOAlgDiff] + # This version released by Tye McQueen (http://perlmonks.org/?node=tye). + # + # =head1 LICENSE + # + # Parts Copyright (c) 2000-2004 Ned Konz. All rights reserved. + # Parts by Tye McQueen. + # + # This program is free software; you can redistribute it and/or modify it + # under the same terms as Perl. + # + # =head1 MAILING LIST + # + # Mark-Jason still maintains a mailing list. To join a low-volume mailing + # list for announcements related to diff and Algorithm::Diff, send an + # empty mail message to mjd-perl-diff-request@plover.com. + # =head1 CREDITS + # + # Versions through 0.59 (and much of this documentation) were written by: + # + # Mark-Jason Dominus, mjd-perl-diff@plover.com + # + # This version borrows some documentation and routine names from + # Mark-Jason's, but Diff.pm's code was completely replaced. + # + # This code was adapted from the Smalltalk code of Mario Wolczko + # , which is available at + # ftp://st.cs.uiuc.edu/pub/Smalltalk/MANCHESTER/manchester/4.0/diff.st + # + # C and C were written by Mike Schilli + # . + # + # The algorithm is that described in + # I, + # CACM, vol.20, no.5, pp.350-353, May 1977, with a few + # minor improvements to improve the speed. + # + # Much work was done by Ned Konz (perl@bike-nomad.com). + # + # The OO interface and some other changes are by Tye McQueen. + # - Copyright (C) 2006-2010 Northrop Grumman Corporation - -License: - - [from cloc.pl: contains the following and standard GPL-2+] - - #!/usr/bin/env perl - # cloc -- Count Lines of Code {{{1 - # Copyright (C) 2006-2010 Northrop Grumman Corporation - # Author: Al Danial - # First release August 2006 - # - # Includes code from: - # - SLOCCount v2.26 - # http://www.dwheeler.com/sloccount/ - # by David Wheeler. - # - Regexp::Common v2.120 - # http://search.cpan.org/~abigail/Regexp-Common-2.120/lib/Regexp/Common.pm - # by Damian Conway and Abigail - # - Win32::Autoglob - # http://search.cpan.org/~sburke/Win32-Autoglob-1.01/Autoglob.pm - # by Sean M. Burke - # - Algorithm::Diff - # http://search.cpan.org/~tyemq/Algorithm-Diff-1.1902/lib/Algorithm/Diff.pm - # by Tye McQueen - - This package 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 package 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, see - -The Debian packaging is licensed under the GPL version 2, or (at your -option), any later version, and is: - - Copyright (C) 2010 Jari Aalto +Files: debian/* +Copyright: + 2010-2013 Jari Aalto +License: GPL-2+ -On Debian systems, the complete text of the GNU General -Public License can be found in "/usr/share/common-licenses/GPL-2". +License: GPL-2+ + This package 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 package 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, see . + . + On Debian systems, the complete text of the GNU General + Public License can be found in "/usr/share/common-licenses/GPL-2". diff -Nru cloc-1.53/debian/copyright-update.debhelper.log cloc-1.60/debian/copyright-update.debhelper.log --- cloc-1.53/debian/copyright-update.debhelper.log 2010-03-18 10:30:29.000000000 +0000 +++ cloc-1.60/debian/copyright-update.debhelper.log 1970-01-01 00:00:00.000000000 +0000 @@ -1,15 +0,0 @@ -dh_auto_configure -dh_auto_build -dh_auto_test -dh_install -dh_installdocs -dh_installman -dh_installchangelogs -dh_perl -dh_strip -dh_compress -dh_fixperms -dh_installdeb -dh_gencontrol -dh_md5sums -dh_builddeb diff -Nru cloc-1.53/debian/copyright-update.substvars cloc-1.60/debian/copyright-update.substvars --- cloc-1.53/debian/copyright-update.substvars 2010-03-18 10:30:28.000000000 +0000 +++ cloc-1.60/debian/copyright-update.substvars 1970-01-01 00:00:00.000000000 +0000 @@ -1 +0,0 @@ -misc:Depends= diff -Nru cloc-1.53/debian/manpages cloc-1.60/debian/manpages --- cloc-1.53/debian/manpages 1970-01-01 00:00:00.000000000 +0000 +++ cloc-1.60/debian/manpages 2013-08-20 04:52:24.000000000 +0000 @@ -0,0 +1 @@ +*.1 diff -Nru cloc-1.53/debian/pod2man.mk cloc-1.60/debian/pod2man.mk --- cloc-1.53/debian/pod2man.mk 2010-03-18 10:30:28.000000000 +0000 +++ cloc-1.60/debian/pod2man.mk 1970-01-01 00:00:00.000000000 +0000 @@ -1,66 +0,0 @@ -# pod2man.mk -- Makefile portion to convert *.pod files to manual pages -# -# Copyright information -# -# Copyright (C) 2008-2010 Jari Aalto -# -# License -# -# 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, see . -# -# Description -# -# Convert *.pod files to manual pages. Write this to 'install' -# target: -# -# install: build $(MANPAGE) - -ifneq (,) - This makefile requires GNU Make. -endif - -# This variable *must* be set when called -PACKAGE ?= package - -# Optional variables to set -MANSECT ?= 1 -PODCENTER = -PODDATE = $$(date "+%Y-%m-%d") - -# Directories -MANSRC = -MANDEST = $(MANSRC) - -MANPOD = $(MANSRC)$(PACKAGE).$(MANSECT).pod -MANPAGE = $(MANDEST)$(PACKAGE).$(MANSECT) - -POD2MAN = pod2man -POD2MAN_FLAGS = --utf8 - -makeman: $(MANPAGE) - -$(MANPAGE): $(MANPOD) - # make target - create manual page from a *.pod page - podchecker $(MANPOD) - LC_ALL= LANG=C $(POD2MAN) $(POD2MAN_FLAGS) \ - --center="$(PODCENTER)" \ - --date="$(PODDATE)" \ - --name="$(PACKAGE)" \ - --section="$(MANSECT)" \ - $(MANPOD) \ - | sed 's,[Pp]erl v[0-9.]\+,$(PACKAGE),' \ - > $(MANPAGE) && \ - rm -f pod*.tmp - -# End of of Makefile part diff -Nru cloc-1.53/debian/rules cloc-1.60/debian/rules --- cloc-1.53/debian/rules 2010-10-11 21:49:12.000000000 +0000 +++ cloc-1.60/debian/rules 2013-08-20 04:52:24.000000000 +0000 @@ -6,20 +6,17 @@ DOCDIR = debian/$(PACKAGE)/usr/share/doc/$(PACKAGE)/doc CHANGELOG = debian/upstream.changelog -include debian/pod2man.mk - -man: - # convert *.pod to manual page - $(MAKE) -C debian -f pod2man.mk PACKAGE=$(PACKAGE) \ - MANSECT=1 PODCENTER=Devel makeman - # Run manaually to get an update get-changelog: - svn log https://cloc.svn.sourceforge.net/svnroot/cloc/trunk/cloc | \ - sed 's/[[:space:]]*$//' \ + svn log https://svn.code.sf.net/p/cloc/code | \ + sed 's/[[:space:]]*$$//' \ > $(CHANGELOG) -override_dh_auto_install: man +override_dh_auto_build: + # If packaged directly from upstream VCS tree + [ -f $(PACKAGE).1 ] || $(MAKE) man + +override_dh_auto_install: install -D -m 755 $(BIN) $(BINDIR)/$(PACKAGE) override_dh_installchangelogs: @@ -30,6 +27,6 @@ %: dh $@ -.PHONY: get-changelog man +.PHONY: get-changelog # End of file diff -Nru cloc-1.53/debian/upstream.changelog cloc-1.60/debian/upstream.changelog --- cloc-1.53/debian/upstream.changelog 2010-03-18 10:30:28.000000000 +0000 +++ cloc-1.60/debian/upstream.changelog 2013-08-20 04:52:24.000000000 +0000 @@ -1,4 +1,1081 @@ ------------------------------------------------------------------------ +r344 | alnd | 2013-08-16 23:10:22 +0300 (Fri, 16 Aug 2013) | 2 lines + +up version number to 1.60 for release + +------------------------------------------------------------------------ +r343 | alnd | 2013-07-14 21:03:40 +0300 (Sun, 14 Jul 2013) | 2 lines + +add support for Pig Latin (feature request 49) + +------------------------------------------------------------------------ +r342 | alnd | 2013-06-09 23:16:40 +0300 (Sun, 09 Jun 2013) | 2 lines + +support for Verilog-SystemVerilog (feature request 47) + +------------------------------------------------------------------------ +r341 | alnd | 2013-06-02 22:11:42 +0300 (Sun, 02 Jun 2013) | 2 lines + +add support for .tar.xz compressed archives + +------------------------------------------------------------------------ +r340 | alnd | 2013-06-02 21:46:52 +0300 (Sun, 02 Jun 2013) | 2 lines + +new option, --max-file-size (bug report 94) + +------------------------------------------------------------------------ +r339 | alnd | 2013-06-02 20:37:47 +0300 (Sun, 02 Jun 2013) | 2 lines + +add duplicate files to ignored hash (feature request 45) + +------------------------------------------------------------------------ +r338 | alnd | 2013-05-20 06:45:34 +0300 (Mon, 20 May 2013) | 3 lines + +- support for Apex Trigger, Visualforce Component, Visualforce Page +- matlab/objective c logic: no mumps points for starting line with % + +------------------------------------------------------------------------ +r337 | alnd | 2013-05-14 06:43:38 +0300 (Tue, 14 May 2013) | 2 lines + +added sass extension for SASS (https://sourceforge.net/p/cloc/feature-requests/43/) + +------------------------------------------------------------------------ +r336 | alnd | 2013-05-10 06:19:00 +0300 (Fri, 10 May 2013) | 2 lines + +add support for SASS + +------------------------------------------------------------------------ +r335 | alnd | 2013-04-29 06:38:07 +0300 (Mon, 29 Apr 2013) | 2 lines + +support for JavaServer Faces (ticket #41) + +------------------------------------------------------------------------ +r334 | alnd | 2013-04-29 06:24:42 +0300 (Mon, 29 Apr 2013) | 2 lines + +use Time::HiRes if available (feature request #39) + +------------------------------------------------------------------------ +r333 | alnd | 2013-04-28 06:56:54 +0300 (Sun, 28 Apr 2013) | 3 lines + +remove useless test for Perl 5.16 and higher on logic that handles +undefined languages (bug #92) + +------------------------------------------------------------------------ +r332 | alnd | 2013-04-28 03:28:02 +0300 (Sun, 28 Apr 2013) | 2 lines + +gant as another file extension for Groovy (feature request #40) + +------------------------------------------------------------------------ +r331 | alnd | 2013-04-22 06:37:18 +0300 (Mon, 22 Apr 2013) | 3 lines + +improvements to MXML handling (support Actionscript) +by Erik Gooven Arellano Casillas + +------------------------------------------------------------------------ +r330 | alnd | 2013-04-22 06:12:47 +0300 (Mon, 22 Apr 2013) | 3 lines + +add support for Razor (feature request 38), again using new +routine remove_between_general + +------------------------------------------------------------------------ +r329 | alnd | 2013-04-22 06:05:12 +0300 (Mon, 22 Apr 2013) | 5 lines + +New routine remove_between_general() which, in principle, obviates +Regexp::Common. +Use remove_between_general to handle /+ .. +/ comments in D (feature +request 37). + +------------------------------------------------------------------------ +r328 | alnd | 2013-04-16 06:37:30 +0300 (Tue, 16 Apr 2013) | 2 lines + +new language: vapi -> Vala Header (feature request #36) + +------------------------------------------------------------------------ +r327 | alnd | 2013-04-16 06:31:04 +0300 (Tue, 16 Apr 2013) | 2 lines + +added .cmake extension for CMake (ticket #89) + +------------------------------------------------------------------------ +r326 | alnd | 2013-04-13 04:12:52 +0300 (Sat, 13 Apr 2013) | 3 lines + +improve unicode_to_ascii() to handle UTF-16 little and big endian; +now should also run faster + +------------------------------------------------------------------------ +r325 | alnd | 2013-03-24 00:42:52 +0200 (Sun, 24 Mar 2013) | 2 lines + +add support for LESS (http://lesscss.org/) feature request #35 + +------------------------------------------------------------------------ +r324 | alnd | 2013-03-14 16:42:34 +0200 (Thu, 14 Mar 2013) | 2 lines + +license section update by Jari Aalto; url instead of snail mail address + +------------------------------------------------------------------------ +r323 | alnd | 2013-03-14 16:41:46 +0200 (Thu, 14 Mar 2013) | 2 lines + +tweaks by Jari Aalto + +------------------------------------------------------------------------ +r322 | alnd | 2013-03-14 06:06:08 +0200 (Thu, 14 Mar 2013) | 2 lines + +begin development branch v1.59 + +------------------------------------------------------------------------ +r321 | alnd | 2013-03-03 20:19:48 +0200 (Sun, 03 Mar 2013) | 2 lines + +revert back to Jari's Makefile based instructions + +------------------------------------------------------------------------ +r320 | alnd | 2013-03-03 20:15:34 +0200 (Sun, 03 Mar 2013) | 2 lines + +tar file contains cloc rather than cloc-1.58.pl + +------------------------------------------------------------------------ +r319 | alnd | 2013-03-03 20:11:14 +0200 (Sun, 03 Mar 2013) | 2 lines + +release notes for v 1.58 + +------------------------------------------------------------------------ +r318 | alnd | 2013-03-03 19:10:49 +0200 (Sun, 03 Mar 2013) | 2 lines + +replace make command with cp + +------------------------------------------------------------------------ +r317 | alnd | 2013-02-28 06:30:35 +0200 (Thu, 28 Feb 2013) | 3 lines + +Show a correct count for 'File pairs compared' in --diff-alignment output +in the presence of duplicate files. + +------------------------------------------------------------------------ +r316 | alnd | 2013-02-28 06:16:05 +0200 (Thu, 28 Feb 2013) | 8 lines + +fix --diff treatment in the presence of multiple file copies by +sorting the list of file names with identical MD5 checksums by +their basenames (bug #87) + +(In practice this could still be a problem if multiple file +copies have the same basename & are just located in different +directories.) + +------------------------------------------------------------------------ +r315 | alnd | 2013-02-24 20:10:19 +0200 (Sun, 24 Feb 2013) | 9 lines + +new option, --force-lang-def + +Changed behavior of --read-lang-def to merge, instead of overwrite, internally +defined language filters; where there are conflicts, use cloc's definition. +The old behavior of --read-lang-def, which override's cloc's definitions, +is available with --force-lang-def. + +more cleanup of cloc.1.pod, replacing with XX + +------------------------------------------------------------------------ +r314 | alnd | 2013-02-21 06:41:55 +0200 (Thu, 21 Feb 2013) | 3 lines + +add 3rd gen scale factor for Maven/XML (otherwise --write-lang-def +generates an undefined value error) + +------------------------------------------------------------------------ +r313 | alnd | 2013-02-17 19:56:53 +0200 (Sun, 17 Feb 2013) | 4 lines + +- trap case where tempdir returns directory containing user's code, + eg MinGW MSYS Perl tempdir returning cwd +- dereference hash on last arg to remove_matches_2re + +------------------------------------------------------------------------ +r312 | alnd | 2013-02-11 02:38:57 +0200 (Mon, 11 Feb 2013) | 2 lines + +change convention of to X when referring to switch arguments + +------------------------------------------------------------------------ +r311 | alnd | 2013-02-11 02:21:59 +0200 (Mon, 11 Feb 2013) | 2 lines + +new option --skip-archive (http://sourceforge.net/p/cloc/feature-requests/32/) + +------------------------------------------------------------------------ +r310 | alnd | 2013-02-11 01:58:23 +0200 (Mon, 11 Feb 2013) | 2 lines + +add support for Arduino Sketch (.ino/.pde) + +------------------------------------------------------------------------ +r309 | alnd | 2013-02-07 07:38:38 +0200 (Thu, 07 Feb 2013) | 4 lines + +clean up documentation a bit +go back to x.xx version number using convention of odd for +development version and even for stable (release) version + +------------------------------------------------------------------------ +r308 | alnd | 2013-01-16 08:16:41 +0200 (Wed, 16 Jan 2013) | 3 lines + +new option, --diff-timeout, to overcome Algorithm::Diff::sdiff() hang +for large inputs + +------------------------------------------------------------------------ +r307 | alnd | 2013-01-16 07:40:22 +0200 (Wed, 16 Jan 2013) | 2 lines + +need quotes around --match-d regex to prevent OS from interpreting pipe + +------------------------------------------------------------------------ +r306 | alnd | 2013-01-16 07:37:44 +0200 (Wed, 16 Jan 2013) | 2 lines + +show example of alternation in regex for --match-d + +------------------------------------------------------------------------ +r305 | alnd | 2013-01-06 03:56:38 +0200 (Sun, 06 Jan 2013) | 2 lines + +increment copyright year + +------------------------------------------------------------------------ +r304 | alnd | 2012-12-02 02:15:43 +0200 (Sun, 02 Dec 2012) | 4 lines + +special case for --diff when input is a single file, have +remove_leading_dirs() only take away the top level directory +(tracker 82) + +------------------------------------------------------------------------ +r303 | alnd | 2012-11-12 06:52:12 +0200 (Mon, 12 Nov 2012) | 2 lines + +ref Jari Aalto patch w/bug report 66 + +------------------------------------------------------------------------ +r302 | alnd | 2012-11-12 06:47:42 +0200 (Mon, 12 Nov 2012) | 3 lines + +version identification change to x.y.z (req by Jari Aalto to +simplify Debian cloc package version comparison) + +------------------------------------------------------------------------ +r301 | alnd | 2012-11-12 06:36:40 +0200 (Mon, 12 Nov 2012) | 2 lines + +s/Ocam/OCaml/ + +------------------------------------------------------------------------ +r300 | alnd | 2012-11-12 06:35:11 +0200 (Mon, 12 Nov 2012) | 2 lines + +additional extentions for OCaml as listed in bug report 81 + +------------------------------------------------------------------------ +r299 | alnd | 2012-11-09 06:37:51 +0200 (Fri, 09 Nov 2012) | 3 lines + +fix bug where files added/deleted were not shown in diff mode +when one of the input directories is empty (bug id 78) + +------------------------------------------------------------------------ +r298 | alnd | 2012-11-05 06:19:51 +0200 (Mon, 05 Nov 2012) | 3 lines + +correct error in --diff --sum-reports for languages starting with +lower case letter (found, fixed by Jason Bryan) + +------------------------------------------------------------------------ +r297 | alnd | 2012-10-30 05:17:19 +0200 (Tue, 30 Oct 2012) | 2 lines + +support for Rust; patch provided by Niko Matsakis + +------------------------------------------------------------------------ +r296 | alnd | 2012-09-26 06:49:40 +0300 (Wed, 26 Sep 2012) | 2 lines + +fix missing .file output when running with --sum-reports (tracker id 3571353) + +------------------------------------------------------------------------ +r295 | alnd | 2012-09-26 06:43:56 +0300 (Wed, 26 Sep 2012) | 3 lines + +in external_utility_exists(), replace csh-style '>& /dev/null' +with more portable '>/dev/null 2>&1' + +------------------------------------------------------------------------ +r294 | alnd | 2012-09-10 00:47:26 +0300 (Mon, 10 Sep 2012) | 2 lines + +separate Ant and Maven logic, file extensions + +------------------------------------------------------------------------ +r293 | alnd | 2012-09-10 00:25:16 +0300 (Mon, 10 Sep 2012) | 3 lines + +first cut at support for Ant and Maven build.xml files +tracker id 3530178 + +------------------------------------------------------------------------ +r292 | alnd | 2012-09-09 23:40:47 +0300 (Sun, 09 Sep 2012) | 2 lines + +single string, no spaces + +------------------------------------------------------------------------ +r291 | alnd | 2012-08-24 07:45:26 +0300 (Fri, 24 Aug 2012) | 4 lines + +A not-pretty fix for "defined(@array) is deprecated" in Perl 5.16. +Since adding "no warnings 'deprecated'" will have to manually comment +this out to test each new Perl version, see what else is changing. + +------------------------------------------------------------------------ +r290 | alnd | 2012-08-08 06:52:51 +0300 (Wed, 08 Aug 2012) | 3 lines + +files provided by Jari Aalto to simplify +the life of package maintainers, ref http://sourceforge.net/tracker/index.php?func=detail&aid=3516557&group_id=174787&atid=870622 + +------------------------------------------------------------------------ +r289 | alnd | 2012-07-19 07:28:18 +0300 (Thu, 19 Jul 2012) | 2 lines + +add support for Vala, feature request tracker ID 3542992 + +------------------------------------------------------------------------ +r288 | alnd | 2012-06-12 08:21:37 +0300 (Tue, 12 Jun 2012) | 2 lines + +suppress "Wrote " when running with --quiet + +------------------------------------------------------------------------ +r287 | alnd | 2012-05-11 07:31:29 +0300 (Fri, 11 May 2012) | 2 lines + +add support for InstallShield (.ism as XML files, but not binary) + +------------------------------------------------------------------------ +r286 | alnd | 2012-05-10 07:17:29 +0300 (Thu, 10 May 2012) | 2 lines + +add support for PowerShell + +------------------------------------------------------------------------ +r285 | alnd | 2012-04-11 07:20:35 +0300 (Wed, 11 Apr 2012) | 2 lines + +start v1.57 + +------------------------------------------------------------------------ +r284 | alnd | 2012-04-10 06:31:58 +0300 (Tue, 10 Apr 2012) | 2 lines + +v1.56 + +------------------------------------------------------------------------ +r283 | alnd | 2012-03-31 22:14:17 +0300 (Sat, 31 Mar 2012) | 2 lines + +implement --show-os + +------------------------------------------------------------------------ +r282 | alnd | 2012-03-31 21:56:19 +0300 (Sat, 31 Mar 2012) | 2 lines + +add support for QML + +------------------------------------------------------------------------ +r281 | alnd | 2012-03-31 21:40:05 +0300 (Sat, 31 Mar 2012) | 3 lines + +correct --by-file --diff leading directory cleanup for regular text, +XML, and YAML output (code for r279 wasn't complete) + +------------------------------------------------------------------------ +r280 | alnd | 2012-03-31 21:27:18 +0300 (Sat, 31 Mar 2012) | 3 lines + +more rigorous implementation of --sdir; previously did not honor --sdir for +extracting archive files + +------------------------------------------------------------------------ +r279 | alnd | 2012-03-31 20:50:48 +0300 (Sat, 31 Mar 2012) | 3 lines + +remove temp directory name from output when running with --by-file on +archive files (tracker ID 3417124) + +------------------------------------------------------------------------ +r278 | alnd | 2012-03-28 08:39:07 +0300 (Wed, 28 Mar 2012) | 2 lines + +implement --csv-delimiter as suggested in feature request id 3510543 + +------------------------------------------------------------------------ +r277 | alnd | 2012-03-28 08:16:31 +0300 (Wed, 28 Mar 2012) | 3 lines + +new options --windows, --unix +only try to count via STDIN on Unix + +------------------------------------------------------------------------ +r276 | alnd | 2012-03-28 08:13:31 +0300 (Wed, 28 Mar 2012) | 2 lines + +add examples; add missing entries; tweak existing entries a bit + +------------------------------------------------------------------------ +r275 | alnd | 2012-03-20 06:41:32 +0200 (Tue, 20 Mar 2012) | 3 lines + +patch by Reuben Thomas to implement counting code piped via STDIN and +supporting option --stdin-name (feature request tracker id 3496670) + +------------------------------------------------------------------------ +r274 | alnd | 2012-03-15 06:44:12 +0200 (Thu, 15 Mar 2012) | 4 lines + +Initialize %count in diff_csv_report() when the 'code' key is empty; +happens when both L and R files are all comments (reported by +jmcrowther@msn.com). + +------------------------------------------------------------------------ +r273 | alnd | 2012-03-08 07:48:37 +0200 (Thu, 08 Mar 2012) | 5 lines + +add support for CoffeeScript (based on patch tracker id 3497080 which in turn +is based on +https://github.com/mbrevoort/docco-husky/commit/9293fd2254f354d78dc6f9e184f417e530ae828f#L4R136 +by Mike Brevoort ) + +------------------------------------------------------------------------ +r272 | alnd | 2012-03-06 07:56:47 +0200 (Tue, 06 Mar 2012) | 2 lines + +oops, test on STDERR, not STDOUT (tracker id 3496669) + +------------------------------------------------------------------------ +r271 | alnd | 2012-03-06 07:53:16 +0200 (Tue, 06 Mar 2012) | 2 lines + +only print bold rubrics if running in a terminal + +------------------------------------------------------------------------ +r270 | alnd | 2012-02-20 07:17:55 +0200 (Mon, 20 Feb 2012) | 3 lines + +copyright change from Jari to Al +first batch of updates to options + +------------------------------------------------------------------------ +r269 | alnd | 2012-02-20 07:01:59 +0200 (Mon, 20 Feb 2012) | 2 lines + +pod file contriubted by Jari Aalto + +------------------------------------------------------------------------ +r268 | alnd | 2012-02-17 07:28:20 +0200 (Fri, 17 Feb 2012) | 2 lines + +add support for ClojureScript (info also by mikkels@gmail.com) + +------------------------------------------------------------------------ +r267 | alnd | 2012-02-14 06:59:37 +0200 (Tue, 14 Feb 2012) | 2 lines + +added support for AutoHotkey (http://www.autohotkey.com/) + +------------------------------------------------------------------------ +r266 | alnd | 2012-02-14 06:55:22 +0200 (Tue, 14 Feb 2012) | 2 lines + +added support for Clojure (info by Mikkel Christiansen, mikkels@gmail.com) + +------------------------------------------------------------------------ +r265 | alnd | 2012-02-14 06:49:50 +0200 (Tue, 14 Feb 2012) | 4 lines + +reverse the sense of $ON_WINDOWS on Windows when $SHELL is defined; +a shell starting with / (ie Cygwin) should run in Unix mode while +anything else should run in Windows mode + +------------------------------------------------------------------------ +r264 | alnd | 2012-01-17 07:30:28 +0200 (Tue, 17 Jan 2012) | 2 lines + +update yacc to recognize C99 comments (ie // text) + +------------------------------------------------------------------------ +r263 | alnd | 2012-01-15 01:21:13 +0200 (Sun, 15 Jan 2012) | 2 lines + +add .git to list of directories that are excluded from processing + +------------------------------------------------------------------------ +r262 | alnd | 2012-01-12 07:18:50 +0200 (Thu, 12 Jan 2012) | 2 lines + +make "--force-lang Smarty,tpl" work despite the file not resembling PHP + +------------------------------------------------------------------------ +r261 | alnd | 2012-01-11 07:42:34 +0200 (Wed, 11 Jan 2012) | 4 lines + +fix duplicate count problem in diff mode when one of the inputs is +an empty file (tracker 3428763) +avoid counting files that have no identified language (in diff mode) + +------------------------------------------------------------------------ +r260 | alnd | 2011-12-21 07:37:40 +0200 (Wed, 21 Dec 2011) | 2 lines + +better detection and reporting of ignored zero sized files + +------------------------------------------------------------------------ +r259 | alnd | 2011-12-16 07:45:08 +0200 (Fri, 16 Dec 2011) | 4 lines + +remove spurious from YAML output +add correct .file or .lang suffix for report file identifier in +header when running with --sum-reports + +------------------------------------------------------------------------ +r258 | alnd | 2011-12-16 07:24:11 +0200 (Fri, 16 Dec 2011) | 3 lines + +fix missing xml/yaml header on the file portion of --sum-reports +tracker id 3433219 + +------------------------------------------------------------------------ +r257 | alnd | 2011-11-30 07:43:10 +0200 (Wed, 30 Nov 2011) | 3 lines + +map .cl extension to both Lisp (as in Common Lisp) and OpenCL and +add a function that can distinguish the contents (tracker 3418515) + +------------------------------------------------------------------------ +r256 | alnd | 2011-11-30 07:00:43 +0200 (Wed, 30 Nov 2011) | 3 lines + +add support for ColdFusion .cfc files but force these to be treated +as CFScript (not CFML) + +------------------------------------------------------------------------ +r255 | alnd | 2011-11-30 06:44:55 +0200 (Wed, 30 Nov 2011) | 2 lines + +associated .ctl and .dsr extensions with Visual Basic (tracker 3440320) + +------------------------------------------------------------------------ +r254 | alnd | 2011-11-10 06:55:39 +0200 (Thu, 10 Nov 2011) | 2 lines + +replace qw() in for loop with exlicit list to remove deprecation warning + +------------------------------------------------------------------------ +r253 | alnd | 2011-11-10 06:45:35 +0200 (Thu, 10 Nov 2011) | 3 lines + +correctly handle multi-line Ruby comments surrounded by =begin/=end +(bug 3433219) + +------------------------------------------------------------------------ +r252 | alnd | 2011-11-03 05:51:23 +0200 (Thu, 03 Nov 2011) | 3 lines + +remove variable %pascal_files; never really used (fixes +bug 3432413) + +------------------------------------------------------------------------ +r251 | alnd | 2011-11-03 05:47:26 +0200 (Thu, 03 Nov 2011) | 2 lines + +start v 1.56 (actually one rev in; r250 included 1.56 code) + +------------------------------------------------------------------------ +r250 | alnd | 2011-10-26 06:49:55 +0300 (Wed, 26 Oct 2011) | 4 lines + +Replace glob() with File::Glob::glob() in in write_file(). This +allows --strip-comments to work (on Linux; untested on Windows) +with files that have spaces in the file name. + +------------------------------------------------------------------------ +r249 | alnd | 2011-10-12 07:13:23 +0300 (Wed, 12 Oct 2011) | 2 lines + +add support for Dart (http://www.dartlang.org/) + +------------------------------------------------------------------------ +r248 | alnd | 2011-10-12 06:59:36 +0300 (Wed, 12 Oct 2011) | 2 lines + +add --sum-one switch (feature request 3419863) + +------------------------------------------------------------------------ +r247 | alnd | 2011-10-12 06:47:36 +0300 (Wed, 12 Oct 2011) | 10 lines + +- start version 1.55 +- fix several XML structural flaws such as reported in bug 3417761; + with these updates the xmlwf reports the following produce correct XML: + --xml + --xml --by-file + --xml --by-file-by-lang + --xml --diff + --xml --by-file --diff + + +------------------------------------------------------------------------ +r246 | alnd | 2011-10-02 06:58:04 +0300 (Sun, 02 Oct 2011) | 2 lines + +v1.54 + +------------------------------------------------------------------------ +r245 | alnd | 2011-09-21 07:19:32 +0300 (Wed, 21 Sep 2011) | 2 lines + +implement --autoconf option to count .in files (tracker id 3325238) + +------------------------------------------------------------------------ +r244 | alnd | 2011-09-21 06:52:57 +0300 (Wed, 21 Sep 2011) | 3 lines + +new routine diff_csv_report() to produce comma separated value +output for --diff (tracker id 3408845) + +------------------------------------------------------------------------ +r243 | alnd | 2011-09-16 06:44:37 +0300 (Fri, 16 Sep 2011) | 3 lines + +Quote metacharacters when comparing directory names against --exclude-dir +value, fixes bug 3410245. Code from patch submitted by bug reporter. + +------------------------------------------------------------------------ +r242 | alnd | 2011-09-15 06:54:58 +0300 (Thu, 15 Sep 2011) | 3 lines + +handle --diff for cases with with empty directory (bug 3398553) +and empty file (bug 3409253) + +------------------------------------------------------------------------ +r241 | alnd | 2011-08-03 07:59:35 +0300 (Wed, 03 Aug 2011) | 3 lines + +support --list-file input for --sum-reports (requested in tracker +ID 3136281 by Eugene Kotlyarov (ekot) + +------------------------------------------------------------------------ +r240 | alnd | 2011-08-01 04:03:49 +0300 (Mon, 01 Aug 2011) | 3 lines + +must additionally remove blank lines in rm_comments() because the comment +removal regex leaves behind residual blank lines + +------------------------------------------------------------------------ +r239 | alnd | 2011-08-01 03:48:12 +0300 (Mon, 01 Aug 2011) | 2 lines + +end of line continuation marker definition for Assembly + +------------------------------------------------------------------------ +r238 | alnd | 2011-08-01 03:45:53 +0300 (Mon, 01 Aug 2011) | 3 lines + +more updates to support non-removal of blank lines preceded by +lines with continuation markers + +------------------------------------------------------------------------ +r237 | alnd | 2011-08-01 03:27:37 +0300 (Mon, 01 Aug 2011) | 5 lines + +New global variable, %EOL_continuation_re, which defines language-specific +end of line continuation regular expressions. To be used when removing +blank lines from code; if a blank line is preceded by a code line ending +with a continuation marker, the blank line is not removed. + +------------------------------------------------------------------------ +r236 | alnd | 2011-07-20 07:09:32 +0300 (Wed, 20 Jul 2011) | 2 lines + +implement --follow-links option (ref tracker id 3304763) + +------------------------------------------------------------------------ +r235 | alnd | 2011-07-07 07:20:48 +0300 (Thu, 07 Jul 2011) | 3 lines + +fix broken handling of .inc files (could be PHP or Pascal) +ref tracker ID 3327245 reported by atafar@sf.net + +------------------------------------------------------------------------ +r234 | alnd | 2011-06-25 07:48:47 +0300 (Sat, 25 Jun 2011) | 3 lines + +patch by atafar@sf.net for bug 3327345, incorrect or not preferred +style for command line options + +------------------------------------------------------------------------ +r233 | alnd | 2011-06-17 06:56:00 +0300 (Fri, 17 Jun 2011) | 4 lines + +add support for CMake based on fixed filename CMakeLists.txt; simplify +future support for assignment of language by fixed filename +(ref tracker id 3317612) + +------------------------------------------------------------------------ +r232 | alnd | 2011-05-09 07:28:39 +0300 (Mon, 09 May 2011) | 7 lines + +Fix diff output problem by basing early exit condition on contents +of %Delta_by_Language rather than %Results_by_Language; this can +happen when no lines of code are modified in common files and +instead only files are added or removed. Most likely this is the +cause of bug 3155945 as well. +oladygin@gmail.com provided inputs which revealed the problem. + +------------------------------------------------------------------------ +r231 | alnd | 2011-05-07 07:11:27 +0300 (Sat, 07 May 2011) | 5 lines + +Handle archive files (tar balls, zip files, etc) with spaces in +their file names by wrapping $archive_file in quotes when making +system call to expand the file (improves security too). Fixes +bug # 3197495. + +------------------------------------------------------------------------ +r230 | alnd | 2011-04-27 04:18:27 +0300 (Wed, 27 Apr 2011) | 3 lines + +fix --diff + --exclude-lang handling when files of the language +to exclude are added or removed; bug 3293243 reported by Andy (awalshe@sf.net) + +------------------------------------------------------------------------ +r229 | alnd | 2011-04-27 04:04:22 +0300 (Wed, 27 Apr 2011) | 3 lines + +fix by Andy (awalshe@sf.net) for bug # 3293155; --counted showing +results by language rather than by file + +------------------------------------------------------------------------ +r228 | alnd | 2011-04-16 19:52:20 +0300 (Sat, 16 Apr 2011) | 5 lines + +Support summation of difference reports (text only at this point). +Driving switch combination is --diff --sum-reports +Code by Andy, awalshe@sf.net, ref tracker ID 3261017 +https://sourceforge.net/tracker/?func=detail&aid=3261017&group_id=174787&atid=870625 + +------------------------------------------------------------------------ +r227 | alnd | 2011-04-16 19:21:46 +0300 (Sat, 16 Apr 2011) | 4 lines + +add support for double extensions; include variants for SQL +Stored Procedures & SQL Data, ref tracker ID 3110838 +http://sourceforge.net/tracker/?func=detail&aid=3110838&group_id=174787&atid=870625 + +------------------------------------------------------------------------ +r226 | alnd | 2011-03-14 03:20:57 +0200 (Mon, 14 Mar 2011) | 3 lines + +add xml/yaml file name if saving results to a file (feature request +3136292) + +------------------------------------------------------------------------ +r225 | alnd | 2011-03-14 03:01:23 +0200 (Mon, 14 Mar 2011) | 4 lines + +For XML and YAML output, replace header line with section containing +entries for URL, version, # lines and files, rate, etc. +Force --xsl to have an argument (arg of 1 triggers default xsl file). + +------------------------------------------------------------------------ +r224 | alnd | 2011-03-13 01:02:07 +0200 (Sun, 13 Mar 2011) | 3 lines + +implement --match-d and --not-match-d as originally suggested by +Michael Bello in July/August 2008 + +------------------------------------------------------------------------ +r223 | alnd | 2011-03-11 07:29:34 +0200 (Fri, 11 Mar 2011) | 2 lines + +make --exclude-file-list work with --diff + +------------------------------------------------------------------------ +r222 | alnd | 2011-02-22 06:19:20 +0200 (Tue, 22 Feb 2011) | 2 lines + +add support for Cython + +------------------------------------------------------------------------ +r221 | alnd | 2011-02-22 06:11:00 +0200 (Tue, 22 Feb 2011) | 4 lines + +Fix output of --counted so that it shows only files which were actually +used to produce the code count. Ref tracker feature request ID 3185747, +patch by sf.net user awalshe. + +------------------------------------------------------------------------ +r220 | alnd | 2011-02-16 07:25:41 +0200 (Wed, 16 Feb 2011) | 3 lines + +check value of $SHELL on Windows; if starts with / then looks +like CygWin, otherwise is most likely MKS Toolkit + +------------------------------------------------------------------------ +r219 | alnd | 2011-02-11 00:14:02 +0200 (Fri, 11 Feb 2011) | 2 lines + +add Smarty (PHP/HTML templating) language + +------------------------------------------------------------------------ +r218 | alnd | 2011-02-10 23:49:12 +0200 (Thu, 10 Feb 2011) | 2 lines + +add support for Ocaml + +------------------------------------------------------------------------ +r217 | alnd | 2011-02-10 23:42:58 +0200 (Thu, 10 Feb 2011) | 2 lines + +add .lisp as an extension for Lisp + +------------------------------------------------------------------------ +r216 | alnd | 2011-02-10 23:37:36 +0200 (Thu, 10 Feb 2011) | 3 lines + +Fix diff bug (tracker ID 3128742) when one input has only one file while +the other has multiple files. + +------------------------------------------------------------------------ +r215 | alnd | 2011-02-10 23:05:54 +0200 (Thu, 10 Feb 2011) | 2 lines + +more todo's + +------------------------------------------------------------------------ +r214 | alnd | 2011-01-22 19:52:32 +0200 (Sat, 22 Jan 2011) | 2 lines + +notes on what to work on + +------------------------------------------------------------------------ +r213 | alnd | 2010-12-22 06:38:54 +0200 (Wed, 22 Dec 2010) | 2 lines + +add support for Objective C++ (tracker id 3141447) + +------------------------------------------------------------------------ +r212 | alnd | 2010-12-12 05:29:30 +0200 (Sun, 12 Dec 2010) | 6 lines + +patch by d_uragan fixes: + - user provided xsl file appears in XML output for --diff + - XML output for --diff + --by-file (and --by-file-by-lang + but there the language part is blank) +ref tracker ID 3126717 + +------------------------------------------------------------------------ +r211 | alnd | 2010-12-04 06:30:11 +0200 (Sat, 04 Dec 2010) | 2 lines + +start version 1.54 + +------------------------------------------------------------------------ +r210 | alnd | 2010-12-02 07:29:49 +0200 (Thu, 02 Dec 2010) | 2 lines + +add support for Google's Go language + +------------------------------------------------------------------------ +r209 | alnd | 2010-12-02 07:17:43 +0200 (Thu, 02 Dec 2010) | 3 lines + +- fix error in xsl comment (found by d_uragan) +- write correct xsl styles when running with --3 option + +------------------------------------------------------------------------ +r208 | alnd | 2010-12-01 07:06:02 +0200 (Wed, 01 Dec 2010) | 2 lines + +XSLT fixes for --by-file and --by-file-by-lang by d_uragan + +------------------------------------------------------------------------ +r207 | alnd | 2010-11-29 07:57:03 +0200 (Mon, 29 Nov 2010) | 2 lines + +change usage instructions to mention diff option in top intro + +------------------------------------------------------------------------ +r206 | alnd | 2010-11-29 07:46:33 +0200 (Mon, 29 Nov 2010) | 2 lines + +on diff XSLT, change block headers to be consistent with non-XML output + +------------------------------------------------------------------------ +r205 | alnd | 2010-11-28 08:03:33 +0200 (Sun, 28 Nov 2010) | 2 lines + +default XSLT for --diff by Blazej Kroll + +------------------------------------------------------------------------ +r204 | alnd | 2010-11-23 08:32:33 +0200 (Tue, 23 Nov 2010) | 2 lines + +added support for MXML, feature request ID 3115156 + +------------------------------------------------------------------------ +r203 | alnd | 2010-11-22 02:31:23 +0200 (Mon, 22 Nov 2010) | 2 lines + +YAML output for --diff + +------------------------------------------------------------------------ +r202 | alnd | 2010-11-22 02:02:37 +0200 (Mon, 22 Nov 2010) | 5 lines + +- correct line and file count in header line (for files/s and lines/s + computation) +- remove XSL reference for XML diff output, can put it in once there's + an .xsl file to use + +------------------------------------------------------------------------ +r201 | alnd | 2010-11-11 19:37:51 +0200 (Thu, 11 Nov 2010) | 3 lines + +remove debug print statements in diff +remove 'defined' for hash, deprecated in 5.12? + +------------------------------------------------------------------------ +r200 | alnd | 2010-11-06 00:10:39 +0200 (Sat, 06 Nov 2010) | 2 lines + +add .pro as a file extension for IDL code + +------------------------------------------------------------------------ +r199 | alnd | 2010-10-30 20:45:10 +0300 (Sat, 30 Oct 2010) | 2 lines + +add --ignore-case option for diffs + +------------------------------------------------------------------------ +r198 | alnd | 2010-10-30 20:30:39 +0300 (Sat, 30 Oct 2010) | 2 lines + +implement --lang-no-ext (Patches ID 3089758 by MySZ) + +------------------------------------------------------------------------ +r197 | alnd | 2010-10-26 07:28:23 +0300 (Tue, 26 Oct 2010) | 3 lines + +don't call the code counter (for diff mode) unless the language is +recognized (Tracker bug 3092605) + +------------------------------------------------------------------------ +r196 | alnd | 2010-10-26 07:14:24 +0300 (Tue, 26 Oct 2010) | 2 lines + +add more "->", "<-" code instrumentation for high verbose levels + +------------------------------------------------------------------------ +r195 | alnd | 2010-10-16 20:56:07 +0300 (Sat, 16 Oct 2010) | 4 lines + +when running diff: include code/comment/blank counts of added files to +total added material, include code/comment/blank counts of removed +files to total removed material (Tracker bug ID 3083342) + +------------------------------------------------------------------------ +r194 | alnd | 2010-10-16 19:46:06 +0300 (Sat, 16 Oct 2010) | 2 lines + +Add // comment marker for Pascal (ref Tracker bug ID 3086695) + +------------------------------------------------------------------------ +r193 | alnd | 2010-10-07 07:38:52 +0300 (Thu, 07 Oct 2010) | 3 lines + +fix inadvertent disabling of --exclude-ext (bug report 3082164 +https://sourceforge.net/tracker/?func=detail&aid=3082164&group_id=174787&atid=870622) + +------------------------------------------------------------------------ +r192 | alnd | 2010-10-02 20:36:06 +0300 (Sat, 02 Oct 2010) | 2 lines + +working version of XML output for --diff + +------------------------------------------------------------------------ +r191 | alnd | 2010-09-26 02:24:26 +0300 (Sun, 26 Sep 2010) | 2 lines + +preliminary work on --xml --diff + +------------------------------------------------------------------------ +r190 | alnd | 2010-09-26 01:49:34 +0300 (Sun, 26 Sep 2010) | 2 lines + +start version 1.53 + +------------------------------------------------------------------------ +r189 | alnd | 2010-08-15 01:33:09 +0300 (Sun, 15 Aug 2010) | 4 lines + +fix file selection logic when a source file has an identical duplicate +with a non-standard filename (ie hello.c and hello.c.bak); pick the +file which passes the language identification test + +------------------------------------------------------------------------ +r188 | alnd | 2010-08-01 07:13:05 +0300 (Sun, 01 Aug 2010) | 3 lines + +fix Windows path normalization problem when supplying fully +qualified path to diff option (found by Mike Szwedo) + +------------------------------------------------------------------------ +r187 | alnd | 2010-07-21 07:34:53 +0300 (Wed, 21 Jul 2010) | 2 lines + +fixes to --exclude-list-file by Joel Oliveira + +------------------------------------------------------------------------ +r186 | alnd | 2010-07-15 08:14:37 +0300 (Thu, 15 Jul 2010) | 2 lines + +new languages: Groovy, Scala, XAML + +------------------------------------------------------------------------ +r185 | alnd | 2010-07-15 07:57:05 +0300 (Thu, 15 Jul 2010) | 4 lines + +- new option, --ignore-whitespace, to ignore whitespace in both + code and comments when computing diffs +- ignore contents of .hg directories + +------------------------------------------------------------------------ +r184 | alnd | 2010-07-08 08:10:51 +0300 (Thu, 08 Jul 2010) | 5 lines + +--exclude-list-file to also ignore directories. While working +on this found that --exclude-dir no longer works for relative +directory names because $File::Find::dir doesn't return the +full path any more. + +------------------------------------------------------------------------ +r183 | alnd | 2010-06-20 03:40:40 +0300 (Sun, 20 Jun 2010) | 3 lines + +new option, --exclude-ext, to ignore files with the given +file extension + +------------------------------------------------------------------------ +r182 | alnd | 2010-06-20 03:24:31 +0300 (Sun, 20 Jun 2010) | 4 lines + +Ignore file name extension case on Windows (map uppercase +file extensions to lowercase). +Prepare for --diff output generation in XML, YAML, etc. + +------------------------------------------------------------------------ +r181 | alnd | 2010-06-20 03:03:36 +0300 (Sun, 20 Jun 2010) | 4 lines + +changes for --diff: + o fix negative line counts for blank lines removed + o correct column output when running with --by-file + +------------------------------------------------------------------------ +r180 | alnd | 2010-05-27 07:37:57 +0300 (Thu, 27 May 2010) | 3 lines + +tweak remove_cobol_blanks() to treat page eject directive as blank line +(code by Greg Toth) + +------------------------------------------------------------------------ +r179 | alnd | 2010-05-13 08:20:01 +0300 (Thu, 13 May 2010) | 2 lines + +zero pad line numbers in html output + +------------------------------------------------------------------------ +r178 | alnd | 2010-05-13 07:55:23 +0300 (Thu, 13 May 2010) | 2 lines + +start v1.52; tweak for Fortran: leading exclamation mark = comment line + +------------------------------------------------------------------------ +r177 | alnd | 2010-05-12 07:44:03 +0300 (Wed, 12 May 2010) | 2 lines + +v1.51 + +------------------------------------------------------------------------ +r176 | alnd | 2010-05-12 07:43:30 +0300 (Wed, 12 May 2010) | 2 lines + +more robust filename globbing on Windows; version 1.51 + +------------------------------------------------------------------------ +r175 | alnd | 2010-04-30 07:44:39 +0300 (Fri, 30 Apr 2010) | 2 lines + +v1.50 + +------------------------------------------------------------------------ +r174 | alnd | 2010-04-30 07:26:24 +0300 (Fri, 30 Apr 2010) | 2 lines + +check for null return value from glob() + +------------------------------------------------------------------------ +r173 | alnd | 2010-04-29 08:23:16 +0300 (Thu, 29 Apr 2010) | 2 lines + +remove --inline option from usage instructions; not ready for prime-time + +------------------------------------------------------------------------ +r172 | alnd | 2010-04-29 07:59:18 +0300 (Thu, 29 Apr 2010) | 2 lines + +another Windows \ file separator -> regex fix + +------------------------------------------------------------------------ +r171 | alnd | 2010-04-28 07:57:37 +0300 (Wed, 28 Apr 2010) | 2 lines + +tidy up --diff-alignment output + +------------------------------------------------------------------------ +r170 | alnd | 2010-04-28 07:40:38 +0300 (Wed, 28 Apr 2010) | 3 lines + +add support for Erlang (feature request ID: 2987880, +http://sourceforge.net/tracker/?func=detail&aid=2987880&group_id=174787&atid=870625) + +------------------------------------------------------------------------ +r169 | alnd | 2010-04-27 09:05:44 +0300 (Tue, 27 Apr 2010) | 2 lines + +new option --diff-alignment for verbose diff comparison output + +------------------------------------------------------------------------ +r168 | alnd | 2010-04-27 08:41:43 +0300 (Tue, 27 Apr 2010) | 2 lines + +trap undefined variable in file alignment + +------------------------------------------------------------------------ +r167 | alnd | 2010-04-27 07:40:25 +0300 (Tue, 27 Apr 2010) | 2 lines + +better error handling when diffs fail due to quoted comments + +------------------------------------------------------------------------ +r166 | alnd | 2010-04-26 07:18:20 +0300 (Mon, 26 Apr 2010) | 2 lines + +format, summation, logic tweaks for diff + +------------------------------------------------------------------------ +r165 | alnd | 2010-04-26 05:42:43 +0300 (Mon, 26 Apr 2010) | 3 lines + +add sum to diff output; invert behavior of inline counting (don't do it +unless asked) + +------------------------------------------------------------------------ +r164 | alnd | 2010-04-25 23:05:19 +0300 (Sun, 25 Apr 2010) | 2 lines + +add code to recognize comments at the end of code lines + +------------------------------------------------------------------------ +r163 | alnd | 2010-04-24 07:24:09 +0300 (Sat, 24 Apr 2010) | 4 lines + +- Remove 3rd generation scaled language count as default behavior + and add switch --3 to produce this output. +- Fix file counts for code diffs. + +------------------------------------------------------------------------ +r162 | alnd | 2010-04-03 08:17:47 +0300 (Sat, 03 Apr 2010) | 2 lines + +remove code that attempts to do interline diff html output + +------------------------------------------------------------------------ +r161 | alnd | 2010-04-03 07:53:43 +0300 (Sat, 03 Apr 2010) | 2 lines + +working pair-wise alignment for diff + +------------------------------------------------------------------------ +r160 | alnd | 2010-04-02 09:10:39 +0300 (Fri, 02 Apr 2010) | 2 lines + +progress on diff pair-wise alignment: have isolated unique filename pairs + +------------------------------------------------------------------------ +r159 | alnd | 2010-04-02 07:23:15 +0300 (Fri, 02 Apr 2010) | 2 lines + +incr to version 1.10; improve diff performance by eliminating inter-line diffs + +------------------------------------------------------------------------ +r158 | alnd | 2010-03-16 07:22:33 +0200 (Tue, 16 Mar 2010) | 2 lines + +utility for use with cloc's --sql options and sqlite3 executable + +------------------------------------------------------------------------ +r157 | alnd | 2010-03-16 07:18:21 +0200 (Tue, 16 Mar 2010) | 2 lines + +version 1.09 + +------------------------------------------------------------------------ r156 | alnd | 2010-03-14 03:27:05 +0200 (Sun, 14 Mar 2010) | 2 lines more tweaks to --yaml --by-file @@ -96,6 +1173,11 @@ (code provided by Tim LaBerge) ------------------------------------------------------------------------ +r139 | alnd | 2009-04-21 07:19:50 +0300 (Tue, 21 Apr 2009) | 2 lines + +release 1.08 + +------------------------------------------------------------------------ r138 | alnd | 2009-04-21 07:19:08 +0300 (Tue, 21 Apr 2009) | 2 lines copyright year to 2009 @@ -228,12 +1310,22 @@ new option --list-file (from code prototype by John Fisher) ------------------------------------------------------------------------ +r115 | alnd | 2008-10-05 07:09:02 +0300 (Sun, 05 Oct 2008) | 2 lines + +1.06 + +------------------------------------------------------------------------ r114 | alnd | 2008-10-05 06:54:57 +0300 (Sun, 05 Oct 2008) | 3 lines fix --extract-with bug introduced in v1.05 (discovered by Jens Schleusener) ------------------------------------------------------------------------ +r113 | alnd | 2008-10-02 07:09:51 +0300 (Thu, 02 Oct 2008) | 2 lines + +v1.05 + +------------------------------------------------------------------------ r112 | alnd | 2008-09-25 08:01:36 +0300 (Thu, 25 Sep 2008) | 2 lines new option, --skip-uniqueness @@ -311,6 +1403,11 @@ by a future, generic, "remove_between" subroutine. ------------------------------------------------------------------------ +r99 | alnd | 2008-07-02 07:58:30 +0300 (Wed, 02 Jul 2008) | 2 lines + +release v1.04 + +------------------------------------------------------------------------ r98 | alnd | 2008-06-17 08:31:16 +0300 (Tue, 17 Jun 2008) | 3 lines improvement suggested by John Taylor Jr.: --progress-rate 0 to suppress @@ -355,6 +1452,11 @@ new option, --html, and supporting code ------------------------------------------------------------------------ +r90 | alnd | 2008-02-16 04:32:08 +0200 (Sat, 16 Feb 2008) | 2 lines + +release v 1.03 + +------------------------------------------------------------------------ r89 | alnd | 2008-02-14 23:35:18 +0200 (Thu, 14 Feb 2008) | 2 lines spelling correction @@ -378,6 +1480,11 @@ be defined from the command line ------------------------------------------------------------------------ +r85 | alnd | 2008-02-09 07:10:26 +0200 (Sat, 09 Feb 2008) | 2 lines + +updates after XML bug fix + +------------------------------------------------------------------------ r84 | alnd | 2008-02-09 07:04:18 +0200 (Sat, 09 Feb 2008) | 3 lines XML output corrections to fix bug 1888765; @@ -431,6 +1538,11 @@ new languages: AMPLE, SKILL, SKILL++ ------------------------------------------------------------------------ +r74 | alnd | 2007-12-22 07:31:44 +0200 (Sat, 22 Dec 2007) | 2 lines + +v1.02 + +------------------------------------------------------------------------ r73 | alnd | 2007-12-22 07:30:44 +0200 (Sat, 22 Dec 2007) | 2 lines increment version number to 1.02 @@ -441,6 +1553,11 @@ added filter for // comments in C/C++ header files ------------------------------------------------------------------------ +r71 | alnd | 2007-12-16 07:29:26 +0200 (Sun, 16 Dec 2007) | 2 lines + +Release 1.01 + +------------------------------------------------------------------------ r70 | alnd | 2007-12-16 07:11:42 +0200 (Sun, 16 Dec 2007) | 2 lines update version number to 1.01 @@ -453,11 +1570,21 @@ added .pcl as an extension for Patran Command Language ------------------------------------------------------------------------ +r68 | alnd | 2007-11-13 00:37:36 +0200 (Tue, 13 Nov 2007) | 2 lines + +tagged release 1.00 + +------------------------------------------------------------------------ r67 | alnd | 2007-11-12 08:05:39 +0200 (Mon, 12 Nov 2007) | 2 lines --csv: header goes at the end of the line with column descriptors ------------------------------------------------------------------------ +r66 | alnd | 2007-11-04 06:14:49 +0200 (Sun, 04 Nov 2007) | 2 lines + +for fixed HTML regex + +------------------------------------------------------------------------ r65 | alnd | 2007-11-04 06:03:22 +0200 (Sun, 04 Nov 2007) | 8 lines Discovered that Regexp::Common's HTML comment regex fails if comments @@ -480,6 +1607,12 @@ insists on this via the --force-lang switch ------------------------------------------------------------------------ +r62 | alnd | 2007-10-31 07:30:51 +0200 (Wed, 31 Oct 2007) | 3 lines + +need to run cloc with '--exclude-dir .svn' to avoid duplicitous counts; +recreate test results (v1.0alpha baseline code) + +------------------------------------------------------------------------ r61 | alnd | 2007-10-31 07:28:25 +0200 (Wed, 31 Oct 2007) | 4 lines contributions by Reuben Thomas: @@ -507,6 +1640,11 @@ YAML output option ------------------------------------------------------------------------ +r56 | alnd | 2007-10-22 09:13:20 +0300 (Mon, 22 Oct 2007) | 2 lines + +regression tester + results (v0.90 baseline) + +------------------------------------------------------------------------ r55 | alnd | 2007-10-22 09:06:31 +0300 (Mon, 22 Oct 2007) | 3 lines new option --sdir to define scratch directory @@ -660,6 +1798,11 @@ (to support z/OS); early exit if using --version ------------------------------------------------------------------------ +r30 | alnd | 2006-08-30 07:20:59 +0300 (Wed, 30 Aug 2006) | 2 lines + +add % comment to help Octave/MATLAB v Objective C decision maker + +------------------------------------------------------------------------ r29 | alnd | 2006-08-30 03:53:43 +0300 (Wed, 30 Aug 2006) | 3 lines First attempt to dynamically check presence of Digest::MD5 and @@ -673,6 +1816,11 @@ Added lua. Added --by_file option (although output is ragged). ------------------------------------------------------------------------ +r27 | alnd | 2006-08-27 05:29:42 +0300 (Sun, 27 Aug 2006) | 2 lines + +Hello, World programs from http://www.roesler-ac.de/wolfram/hello.htm + +------------------------------------------------------------------------ r26 | alnd | 2006-08-27 02:28:24 +0300 (Sun, 27 Aug 2006) | 2 lines always call remove_c_comments last in a filter list; add MUMPS @@ -734,6 +1882,11 @@ code to identify .m files as either matlab or objective C ------------------------------------------------------------------------ +r14 | alnd | 2006-08-17 08:40:30 +0300 (Thu, 17 Aug 2006) | 2 lines + +this file causes cloc to segfault in remove_c_comments() + +------------------------------------------------------------------------ r13 | alnd | 2006-08-17 07:18:41 +0300 (Thu, 17 Aug 2006) | 2 lines more output cleanup, more languages @@ -749,6 +1902,11 @@ Report printing tweaks. Still needs improvement. ------------------------------------------------------------------------ +r10 | alnd | 2006-08-16 08:35:25 +0300 (Wed, 16 Aug 2006) | 2 lines + +Beginnings of a test suite; these taken from SLOCCount. + +------------------------------------------------------------------------ r9 | alnd | 2006-08-16 07:43:28 +0300 (Wed, 16 Aug 2006) | 3 lines insert code from Regexp::Common to handle difficult languages @@ -786,3 +1944,13 @@ initial ------------------------------------------------------------------------ +r2 | alnd | 2006-08-14 06:07:21 +0300 (Mon, 14 Aug 2006) | 2 lines + +initial + +------------------------------------------------------------------------ +r1 | alnd | 2006-08-14 06:02:17 +0300 (Mon, 14 Aug 2006) | 2 lines + +initial + +------------------------------------------------------------------------ diff -Nru cloc-1.53/debian/watch cloc-1.60/debian/watch --- cloc-1.53/debian/watch 2010-03-18 10:30:28.000000000 +0000 +++ cloc-1.60/debian/watch 2013-08-20 04:52:24.000000000 +0000 @@ -1,2 +1,2 @@ version=3 -http://sf.net/cloc/cloc-(\d.+)\.pl +http://sf.net/cloc/cloc-([\d.]+)\.tar\.gz diff -Nru cloc-1.53/pod2man.mk cloc-1.60/pod2man.mk --- cloc-1.53/pod2man.mk 1970-01-01 00:00:00.000000000 +0000 +++ cloc-1.60/pod2man.mk 2013-08-16 21:19:56.000000000 +0000 @@ -0,0 +1,70 @@ +# pod2man.mk -- Makefile portion to convert *.pod files to manual pages +# +# Copyright information +# +# Copyright (C) 2008-2012 Jari Aalto +# +# License +# +# 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, see . +# +# Description +# +# Convert *.pod files to manual pages. Add this to Makefile: +# +# PACKAGE = package +# +# man: +# make -f pod2man.mk PACKAGE=$(PACKAGE) makeman +# +# build: man + +ifneq (,) + This makefile requires GNU Make. +endif + +# This variable *must* be set when called +PACKAGE ?= package + +# Optional variables to set +MANSECT ?= 1 +PODCENTER ?= User Commands +PODDATE ?= $$(date "+%Y-%m-%d") + +# Directories +MANSRC ?= +MANDEST ?= $(MANSRC) + +MANPOD ?= $(MANSRC)$(PACKAGE).$(MANSECT).pod +MANPAGE ?= $(MANDEST)$(PACKAGE).$(MANSECT) + +POD2MAN ?= pod2man +POD2MAN_FLAGS ?= --utf8 + +makeman: $(MANPAGE) + +$(MANPAGE): $(MANPOD) + # make target - create manual page from a *.pod page + podchecker $(MANPOD) + LC_ALL= LANG=C $(POD2MAN) $(POD2MAN_FLAGS) \ + --center="$(PODCENTER)" \ + --date="$(PODDATE)" \ + --name="$(PACKAGE)" \ + --section="$(MANSECT)" \ + $(MANPOD) \ + | sed 's,[Pp]erl v[0-9.]\+,$(PACKAGE),' \ + > $(MANPAGE) && \ + rm -f pod*.tmp + +# End of of Makefile part diff -Nru cloc-1.53/sqlite_formatter cloc-1.60/sqlite_formatter --- cloc-1.53/sqlite_formatter 1970-01-01 00:00:00.000000000 +0000 +++ cloc-1.60/sqlite_formatter 2013-08-16 21:19:56.000000000 +0000 @@ -0,0 +1,57 @@ +#!/usr/bin/env perl +use warnings; +use strict; +# +# Pretty printer for from sqlite3 output. +# Assumes column headers are enabled with +# .header on +# in ~/.sqliterc +# al.danial@gmail.com March 2010 +# + +my $sqlite_separator = '\|'; + +my @lines = (); + +# ingest all lines +while (<>) { + chomp; + push @lines, $_; +} + +# split on |, the default sqlite3 output separator +my @column_width = (); +my $nCols = 0; +my @data = (); # $data[$row][$column] = SQLite result +for (my $row = 0; $row < scalar @lines; $row++) { + my @cols = split($sqlite_separator, $lines[$row]); + $nCols = scalar @cols; + for (my $col = 0; $col < $nCols; $col++) { + $data[$row][$col] = $cols[$col]; + $column_width[$col] = 0 unless defined $column_width[$col]; + $column_width[$col] = length($cols[$col]) if + $column_width[$col] < length($cols[$col]); + } +} + +# write the results +my $format_str = ""; +for (my $row = 0; $row < scalar @data; $row++) { + # insert a separator row + if ($row == 1) { + for (my $col = 0; $col < $nCols; $col++) { + print '_' x $column_width[$col], " "; + } + print "\n"; + } + for (my $col = 0; $col < $nCols; $col++) { + if ($data[$row][$col] =~ /^[-]?\d+$/) { + # an integer, align to right + $format_str = "%" . $column_width[$col] . "d "; + } else { + $format_str = "%-" . $column_width[$col] . "s "; + } # could use something for floating point numbers too... + printf $format_str, $data[$row][$col]; + } + print "\n"; +} diff -Nru cloc-1.53/version cloc-1.60/version --- cloc-1.53/version 1970-01-01 00:00:00.000000000 +0000 +++ cloc-1.60/version 2013-08-20 04:17:31.000000000 +0000 @@ -0,0 +1 @@ +1.60