source:
NEMO/releases/r4.0/r4.0-HEAD/doc/tools/manuals_checking.sh
@
13272
Last change on this file since 13272 was 11004, checked in by nicolasmartin, 5 years ago | |
---|---|
|
|
File size: 2.3 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 | for model in $models; do |
12 | [[ $model =~ ^(SI3|TOP)$ ]] && continue |
13 | |
14 | files=$( find latex/$model -type f -name *.tex ) |
15 | |
16 | echo '¤ Missing namelist groups in '$model' manual' |
17 | |
18 | for nlst in $( ls namelists ); do |
19 | [[ ! $( grep \\nlst{$nlst} $files ) ]] && printf '%s ' $nlst |
20 | done |
21 | |
22 | echo; echo |
23 | echo '¤ Vanished index entries in '$model' manual (\{hf,jp,key,mdl,ngn,nlst,np,rou}{...})' |
24 | |
25 | for file in $files; do |
26 | |
27 | items=$( grep -Eho "(hf|jp|key|mdl|ngn|nlst|np|rou){[a-zA-Z0-9_\]*}" $file | sort -u ) |
28 | |
29 | if [[ $items == '' ]]; then |
30 | continue |
31 | else |
32 | printf ${file/latex\/*\/subfiles\/}': ' |
33 | fi |
34 | |
35 | for item in $items; do |
36 | |
37 | arg=$( echo $item | sed 's/.*{\([^}]*\)}/\1/' | tr -d '\\' ) |
38 | |
39 | if [[ ( $item =~ ^hf && ! $( find ../src -type f -name $arg.h90 ) ) || \ |
40 | ( $item =~ ^jp && ! $( grep ":: *$arg" ../src/OCE/par_oce.F90 ) ) || \ |
41 | ( $item =~ ^key && ! $( grep -ri "#if .* $arg" ../src ) ) || \ |
42 | ( $item =~ ^mdl && ! $( find ../src -type f -name $arg.[Ff]90 ) ) || \ |
43 | ( $item =~ ^ngn && ! $( grep \&$arg namelists/* ) ) || \ |
44 | ( $item =~ ^nlst && ! -f namelists/$arg ) || \ |
45 | ( $item =~ ^np && ! $( grep " $arg *=" namelists/* ) ) || \ |
46 | ( $item =~ ^rou && ! $( grep -ri "SUBROUTINE *$arg" ../src ) ) ]]; then |
47 | printf $item' ' |
48 | fi |
49 | |
50 | done |
51 | |
52 | echo |
53 | |
54 | done |
55 | |
56 | done |
57 | |
58 | echo |
59 | echo '¤ Namelist parameters unfollowing naming conventions (^[cdlnr]n_* or uppercase somewhere)' |
60 | |
61 | for nlst in $( ls namelists ); do |
62 | np_list=$( sed '/^ *[!/&]/d; s|[!/&].*||' namelists/$nlst | tr -d ' ' | cut -d= -f1 ) |
63 | array=() |
64 | |
65 | for np in ${np_list}; do |
66 | |
67 | if [[ ! ${np:0:3} =~ ^[cdlnr]n_$ || $( echo $np | grep [A-Z] ) ]]; then |
68 | array+=$np' ' |
69 | fi |
70 | |
71 | done |
72 | |
73 | if (( ${#array[@]} != 0 )); then |
74 | printf '%15s: ' $nlst |
75 | echo ${array[@]} |
76 | fi |
77 | |
78 | done |
79 | |
80 | exit 0 |
Note: See TracBrowser
for help on using the repository browser.