/[MITgcm]/MITgcm_contrib/jmc_script/derive_other_types
ViewVC logotype

Contents of /MITgcm_contrib/jmc_script/derive_other_types

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.1 - (show annotations) (download)
Mon May 11 12:32:37 2009 UTC (14 years, 11 months ago) by jmc
Branch: MAIN
add the little script I used to update src files: "mdsio_pass_r{4,8}tor{l,s}.F"
after changing just the 1rst one.

1 #!/bin/sh
2
3 # $Header: $
4 # $Name: $
5
6 #- This script is intended to help keeping up to date the 4 source files:
7 # "mdsio_pass_r{4,8}tor{l,s}.F" (same code, just different type R4,R8,RS,RL)
8 # From the 1rst src file (mdsio_pass_r4torl.F), derive the 3 others
9 # but keeping the original CVS header
10
11 showDiff=1
12 chg4to8=tmp_A.$$
13 tmpOutF=tmp_O.$$
14 cat <<EOF >> $chg4to8
15 s/R4/R8/g
16 s/Real\*4/Real*8/g
17 s/real\*4/real*8/g
18 EOF
19
20 xx='mdsio_pass_r8torl.F'
21 yy=`echo $xx | sed 's/_r8/_r4/'`
22 echo "generate $xx from $yy"
23 sed -n '/^C \$Header:/p' $xx > $tmpOutF
24 sed -f $chg4to8 $yy | sed '/^C \$Header:/d' >> $tmpOutF
25 cmp -s $xx $tmpOutF
26 outp=$?
27 #echo $outp
28 if test $outp = 0 ; then
29 echo ' no changes in:' $xx
30 rm -f $tmpOutF
31 else
32 if test $showDiff = 1 ; then
33 echo "diff $xx $tmpOutF"
34 diff $xx $tmpOutF
35 fi
36 echo 'Update:' $xx
37 mv -i $tmpOutF $xx
38 fi
39
40
41 for xx in `ls mdsio_pass_r?tors.F`
42 do
43 yy=`echo $xx | sed 's/rs\.F$/rl.F/'`
44 echo "generate $xx from $yy"
45 sed -n '/^C \$Header:/p' $xx > $tmpOutF
46 sed 's/RL/RS/g' $yy | sed '/^C \$Header:/d' >> $tmpOutF
47 cmp -s $xx $tmpOutF
48 outp=$?
49 #echo $outp
50 if test $outp = 0 ; then
51 echo ' no changes in:' $xx
52 rm -f $tmpOutF
53 else
54 if test $showDiff = 1 ; then
55 echo "diff $xx $tmpOutF"
56 diff $xx $tmpOutF
57 fi
58 echo 'Update:' $xx
59 mv -i $tmpOutF $xx
60 fi
61 done
62
63 rm -f $chg4to8

  ViewVC Help
Powered by ViewVC 1.1.22