Debian Codegraph @

dist/validate/s_chk_stats

raw symbols SCIP
1 #!/bin/sh -
2 #
3 # $Id$
4 #
5 # Check to make sure all of the stat structure members are included in
6 # all of the possible formats.
7
8 # Top-level directory.
9
10 d=../..
11 [ -f $d/LICENSE ] || {
12 echo 'FAIL: cannot find source distribution directory.'
13 exit 1
14 }
15
16 docs=$d/docs/api_reference
17 s=$d/src
18 l=$d/lang
19
20 # Docs aren't in the source tree anymore, so we can't check the completeness.
21 check_docs="no"
22 exitv=0
23 t1=__tmp
24
25 # Extract the field names for a structure from the db.h file.
26 inc_fields()
27 {
28 sed -e "/struct $1 {/,/^};$/p" \
29 -e d < $s/dbinc/db.in |
30 sed -e 1d \
31 -e '$d' \
32 -e '/;/!d' \
33 -e 's/;.*//' \
34 -e 's/^[ ].*[ \*]//'
35 }
36
37 cat << END_OF_IGNORE > IGNORE
38 bt_maxkey
39 bt_metaflags
40 hash_metaflags
41 qs_metaflags
42 qs_ndata
43 st_hash_max_nowait
44 st_filefail_cleanups
45 END_OF_IGNORE
46
47 # Check to make sure the elements of a structure from db.h appear in
48 # the other files.
49 inc()
50 {
51 for i in `inc_fields $1`; do
52 if egrep -w $i IGNORE > /dev/null; then
53 echo " $1: ignoring $i"
54 continue
55 fi
56 for j in $2; do
57 # Docs aren't in the tree any more, skip the checks.
58 if [ ! -e $j ]; then
59 ext=`echo $j | awk -F . '{print $NF}'`
60 if [ "$ext" != "html" \
61 -o "$check_docs" = "yes" ]; then
62 echo "$j file not found, skipping."
63 fi
64 continue
65 fi
66 if egrep -w $i $j > /dev/null; then
67 :;
68 else
69 echo " $1: $i not found in $j."
70 exitv=1
71 fi
72 done
73 done
74 }
75
76 inc "__db_bt_stat" "$l/tcl/tcl_db.c $s/btree/bt_stat.c $docs/C/dbstat.html"
77 inc "__db_h_stat" "$l/tcl/tcl_db.c $s/hash/hash_stat.c $docs/C/dbstat.html"
78 inc __db_lock_stat \
79 "$l/tcl/tcl_lock.c $s/lock/lock_stat.c $docs/C/lockstat.html"
80 inc __db_log_stat "$l/tcl/tcl_log.c $s/log/log_stat.c $docs/C/logstat.html"
81 inc __db_mpool_fstat \
82 "$l/tcl/tcl_mp.c $s/mp/mp_stat.c $docs/C/mempstat.html"
83 inc __db_mpool_stat \
84 "$l/tcl/tcl_mp.c $s/mp/mp_stat.c $docs/C/mempstat.html"
85 inc __db_mutex_stat \
86 "$s/mutex/mut_stat.c $docs/C/mutexstat.html"
87 inc "__db_qam_stat" \
88 "$l/tcl/tcl_db.c $s/qam/qam_stat.c $docs/C/dbstat.html"
89 inc __db_rep_stat \
90 "$l/tcl/tcl_rep.c $s/rep/rep_stat.c $docs/C/repstat.html"
91 inc __db_seq_stat \
92 "$l/tcl/tcl_seq.c $s/sequence/seq_stat.c $docs/C/seqstat.html"
93 inc __db_txn_stat \
94 "$l/tcl/tcl_txn.c $s/txn/txn_stat.c $docs/C/txnstat.html"
95
96 # Check to make sure the elements from a man page appears in db.in.
97 man()
98 {
99 for i in `cat $t`; do
100 if egrep -w $i IGNORE > /dev/null; then
101 echo " $1: ignoring $i"
102 continue
103 fi
104 if egrep -w $i $s/dbinc/db.in > /dev/null; then
105 :;
106 else
107 echo " $1: $i not found in db.h."
108 exitv=1
109 fi
110 done
111 }
112
113 if [ "$check_docs" = "yes" ]; then
114 sed -e '/m4_field(/!d' \
115 -e 's/.*m4_field[^,]*,[ ]*\([^,]*\).*/\1/' < \
116 $docs/C/dbstat.html > $t
117 man "checking db_stat.so against db.h"
118
119 sed -e '/m4_field(/!d' \
120 -e 's/.*m4_field[^,]*,[ ]*\([^,]*\).*/\1/' < \
121 $docs/C/lockstat.html > $t
122 man "checking lock_stat.so against db.h"
123
124 sed -e '/m4_field(/!d' \
125 -e 's/.*m4_field[^,]*,[ ]*\([^,]*\).*/\1/' < \
126 $docs/C/logstat.html > $t
127 man "checking log_stat.so against db.h"
128
129 sed -e '/m4_field(/!d' \
130 -e 's/.*m4_field[^,]*,[ ]*\([^,]*\).*/\1/' < \
131 $docs/C/mempstat.html > $t
132 man "checking memp_stat.so against db.h"
133
134 sed -e '/m4_field(/!d' \
135 -e 's/.*m4_field[^,]*,[ ]*\([^,]*\).*/\1/' < \
136 $docs/C/repstat.html > $t
137 man "checking rep_stat.so against db.h"
138
139 sed -e '/m4_field(/!d' \
140 -e 's/.*m4_field[^,]*,[ ]*\([^,]*\).*/\1/' < \
141 $docs/C/seqstat.html > $t
142 man "checking seq_stat.so against db.h"
143
144 sed -e '/m4_field(/!d' \
145 -e 's/.*m4_field[^,]*,[ ]*\([^,]*\).*/\1/' \
146 -e 's/__LB__.*//' < $docs/C/txnstat.html > $t
147 man "checking txn_stat.so against db.h"
148 fi
149
150 rm -f IGNORE
151
152 exit $exitv