Debian Codegraph @

count-loc

raw
1 #!/usr/bin/scsh -s
2 !#
3
4 ; -*-scheme-*-
5
6 (define add-up
7 (lambda (dir-name depth)
8
9 (let* ((depth-str (number->string depth))
10 (str
11 (car (run/strings (| (find ,dir-name "-maxdepth" ,depth-str
12 "(" -name "*.c"
13 -o -name "*.cc"
14 -o -name "*.h"
15 -o -name "*.hh"
16 -o -name "*.cpp"
17 -o -name "configure.in"
18 -o -name "Makefile.am"
19 -o -name "*.m4"
20 -o -name "ChangeLog"
21 -o -name "*.tex"
22 ")")
23 (xargs wc -l)
24 (tail -1))))))
25
26 (format #t "~s: ~s~%" dir-name str)
27
28 ; the number is the first part of the string, but after
29 ; some spaces (which get transformed into "")
30 ;
31 (string->number (car (cdr ((infix-splitter) str)))))))
32
33
34
35
36 ; (let ((intl-dir-count (add-up "intl" 1))
37 ; ( all-dir-count (add-up "." 2)))
38
39 ; (format #t "Lines of code: ~s~%"
40 ; (- all-dir-count intl-dir-count)))
41
42
43 (format #t "Lines of code: ~s~%" (add-up "." 2))
44
45
46