Fix typo
[rofl0r-order-pp.git] / Statistics
blobdfc7d0c728852bb6b15121d453733c0454e99a97
1 #!/bin/bash
3 # (C) Copyright Vesa Karvonen 2004.
5 # Distributed under the Boost Software License, Version 1.0.
6 # (See accompanying file LICENSE.)
8 set -e
10 function stats {
11 local code="$(cat $1)"
13 echo "\
14 Source files : $(echo "$1" | wc -l)
15 Source lines : $(cat $1 | wc -l)
16 Source bytes : $(cat $1 | wc -c)
17 Comment lines : $(echo "$code" | grep "^[ \t]*//" | wc -l)
18 Macros : $(echo "$code" | grep "^#[ \t]*define" | wc -l)
19 Order DEF_8 defs : $(echo "$code" | grep "^#[ \t]*define[ \t]\\+ORDER_PP_DEF_8" | wc -l)
20 Order SYM defs : $(echo "$code" | grep "^#[ \t]*define[ \t]\\+ORDER_PP_SYM_" | wc -l)
21 Order TOKEN defs : $(echo "$code" | grep "^#[ \t]*define[ \t]\\+[A-Z_]\\+_TOKEN_[^ ]\\+[ \t]\\+(" | wc -l) (approximate)"
24 echo "\
25 Order interpreter plus prelude statistics
27 $(stats "$(find inc -name '*.h' -a -not -path '*/lib/*')")
29 Order library statistics
31 $(stats "$(find inc -name '*.h' -a -path '*/lib/*')")
33 Order examples statistics
35 $(stats "$(find example -name '*.h*' -o -name '*.c*')")"