File: wc.sh

package info (click to toggle)
sbcl 1:0.9.16.0-1
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 19,960 kB
  • ctags: 16,537
  • sloc: lisp: 231,164; ansic: 19,558; asm: 2,539; sh: 1,925; makefile: 308
file content (25 lines) | stat: -rwxr-xr-x 1,039 bytes parent folder | download | duplicates (8)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#!/bin/sh
set -e

# How big is this project anyway? Crudely estimate non-comment source lines..

echo -n "approximate Lisp source lines: "
find . -name "*.lisp" -print | xargs egrep -hs '^[ 	]*[^ 	;]' | wc -l
echo -n "approximate Lisp source non-whitespace chars: "
find . -name "*.lisp" -print | xargs egrep -hs '^[ 	]*[^ 	;]' \
  | perl -ne 's/\s//g ; print' | wc -c
# some errors in Lisp counting above:
#   * doesn't catch #| .. |#
#   * doesn't catch #+NIL convention for commenting out forms
#   * doesn't catch stale source files which are no longer used

echo -n "approximate C source lines: "
find . -name "*.[ch]" -print | xargs egrep -s '^[ 	]*[^ 	/*]' | wc -l
# errors:
#   * only crudely approximates "/*"-style commenting (using the assumption
#     that all lines beginning with "/" or "*" are beginning of comments or
#     continuation of comments respectively)
#   * doesn't catch #if 0 convention for commenting out blocks
#   * doesn't catch stale source files which are no longer used

echo "(ignoring .sh, .S, etc.)"