New URL for NEMO forge!   http://forge.nemo-ocean.eu

Since March 2022 along with NEMO 4.2 release, the code development moved to a self-hosted GitLab.
This present forge is now archived and remained online for history.
manuals_checking.sh in NEMO/trunk/doc/bin – NEMO

source: NEMO/trunk/doc/bin/manuals_checking.sh @ 10550

Last change on this file since 10550 was 10550, checked in by nicolasmartin, 5 years ago

Modify script checking the LaTeX files to report the ones to be updated

  • Property svn:executable set to *
File size: 2.3 KB
RevLine 
[10075]1#!/bin/sh
2
[10443]3#set -evx
4
[10146]5if [[ $* != '' ]]; then
[10443]6    if [[ $1 = 'all' ]]; then models='NEMO SI3 TOP'; else models=$1; fi
[10146]7else
[10443]8    models='NEMO'
[10146]9fi
10
[10443]11extract_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
[10146]16for model in $models; do
[10443]17    [[ $model =~ ^(SI3|TOP)$ ]] && continue
[10146]18
[10443]19    tex_files=$( find latex/$model -type f -name *.tex )
[10146]20
[10443]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
[10550]28    echo '¤ Chapters with vanished entries in '$model' manual (\{hf,jp,key,mdl,ngn,nlst,np,rou}{...})'
[10443]29
[10550]30    for file in ${tex_files}; do
[10443]31
[10550]32        items=$( grep -Eho "(hf|jp|key|mdl|ngn|nlst|np|rou){[a-zA-Z0-9_\]*}" $file | sort -u )
[10443]33
[10550]34        [[ $items == '' ]] && continue
35
36        printf $file': '
37
38        for item in $items; do
39
40            if [[ ( $item =~ 'hf'   && ! $( find ../src -type f -name   $arg.h90               ) ) || \
41                  ( $item =~ 'jp'   && ! $( grep ":: *$arg"             ../src/OCE/par_oce.F90 ) ) || \
42                  ( $item =~ 'key'  && ! $( grep -ri "#if .* $arg"      ../src                 ) ) || \
43                  ( $item =~ 'mdl'  && ! $( find ../src -type f -name   $arg.[Ff]90            ) ) || \
44                  ( $item =~ 'ngn'  && ! $( grep \&$arg                 namelists/*            ) ) || \
45                  ( $item =~ 'nlst' && ! -f namelists/$arg                                       ) || \
46                  ( $item =~ 'np'   && ! $( grep " $arg *="             namelists/*            ) ) || \
47                  ( $item =~ 'rou'  && ! $( grep -ri "SUBROUTINE *$arg" ../src                 ) )      ]]; then
48                printf $item' '
[10443]49            fi
[10550]50
[10443]51        done
52
[10550]53        echo
[10443]54
[10550]55    done
56
[10443]57done
58
59echo
[10448]60echo '¤ Namelist parameters unfollowing naming conventions (^[cdlnr]n_* or uppercase somewhere)'
[10443]61
62for nlst in $( ls namelists ); do
[10448]63    np_list=$( sed '/^ *[!/&]/d; s|[!/&].*||' namelists/$nlst | tr -d ' ' | cut -d= -f1 )
[10443]64    array=()
65
66    for np in ${np_list}; do
67
[10448]68        if [[ ! ${np:0:3} =~ ^[cdlnr]n_$ || $( echo $np | grep [A-Z] ) ]]; then
[10443]69            array+=$np' '
[10146]70        fi
71
72    done
73
[10443]74    if (( ${#array[@]} != 0 )); then
75        printf '%15s: ' $nlst
76        echo ${array[@]}
77    fi
[10146]78
[10075]79done
80
81exit 0
Note: See TracBrowser for help on using the repository browser.