source:
NEMO/trunk/doc/bin/manuals_checking.sh
@
10501
Last change on this file since 10501 was 10448, checked in by nicolasmartin, 5 years ago | |
---|---|
|
|
File size: 2.0 KB |
Line | |
---|---|
1 | #!/bin/sh |
2 | |
3 | #set -evx |
4 | |
5 | if [[ $* != '' ]]; then |
6 | if [[ $1 = 'all' ]]; then models='NEMO SI3 TOP'; else models=$1; fi |
7 | else |
8 | models='NEMO' |
9 | fi |
10 | |
11 | extract_arg() { |
12 | ## $1: macro name, $2: prefix for filtering args (optional) |
13 | eval grep -Poh "\\$1{\\$2\\\K[^}]+" ${tex_files} | tr -d '\\' | sort -u |
14 | } |
15 | |
16 | for model in $models; do |
17 | [[ $model =~ ^(SI3|TOP)$ ]] && continue |
18 | |
19 | tex_files=$( find latex/$model -type f -name *.tex ) |
20 | |
21 | echo '¤ Missing namelist groups in '$model' manual' |
22 | |
23 | for nlst in $( ls namelists ); do |
24 | [[ ! $( grep \\nlst{$nlst} ${tex_files} ) ]] && printf '%s ' $nlst |
25 | done |
26 | |
27 | echo; echo |
28 | echo '¤ Vanished references in '$model' manual (\\autoref{...})' |
29 | |
30 | for item in 'mdl' 'ngn' 'nlst' 'np' 'rou'; do |
31 | echo '- '$item':' |
32 | args_list=$( extract_arg $item ) |
33 | |
34 | for arg in ${args_list}; do |
35 | |
36 | if [[ "$item" == 'nlst' && ! -f namelists/$arg ]]; then |
37 | printf '%15s: ' $arg |
38 | grep -l \\nlst{$arg} ${tex_files} | sed 's/^.*\///' |
39 | elif [[ ( "$item" == 'mdl' && ! $( find ../src -type f -name $arg.[Ffh]90 ) ) || \ |
40 | ( "$item" == 'ngn' && ! $( grep \&$arg namelists/* ) ) || \ |
41 | ( "$item" == 'rou' && ! $( grep -ri "SUBROUTINE *$arg" ../src ) ) || \ |
42 | ( "$item" == 'np' && ! $( grep " $arg *=" namelists/* ) ) ]]; then |
43 | printf '%s ' $arg |
44 | fi |
45 | |
46 | done |
47 | |
48 | [ "$item" != 'nlst' ] && echo |
49 | done |
50 | |
51 | done |
52 | |
53 | echo |
54 | echo '¤ Namelist parameters unfollowing naming conventions (^[cdlnr]n_* or uppercase somewhere)' |
55 | |
56 | for nlst in $( ls namelists ); do |
57 | np_list=$( sed '/^ *[!/&]/d; s|[!/&].*||' namelists/$nlst | tr -d ' ' | cut -d= -f1 ) |
58 | array=() |
59 | |
60 | for np in ${np_list}; do |
61 | |
62 | if [[ ! ${np:0:3} =~ ^[cdlnr]n_$ || $( echo $np | grep [A-Z] ) ]]; then |
63 | array+=$np' ' |
64 | fi |
65 | |
66 | done |
67 | |
68 | if (( ${#array[@]} != 0 )); then |
69 | printf '%15s: ' $nlst |
70 | echo ${array[@]} |
71 | fi |
72 | |
73 | done |
74 | |
75 | exit 0 |
Note: See TracBrowser
for help on using the repository browser.