/[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.2 - (show annotations) (download)
Mon May 11 13:15:12 2009 UTC (10 years, 10 months ago) by jmc
Branch: MAIN
CVS Tags: testing_tag01, HEAD
Changes since 1.1: +7 -5 lines
Try to prevent CVS to expand all the "header" that the script is supposed
 to process.

1 #!/bin/sh
2
3 # $Header: /u/gcmpack/MITgcm_contrib/jmc_script/derive_other_types,v 1.1 2009/05/11 12:32:37 jmc Exp $
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 kWord='Header'
21
22 xx='mdsio_pass_r8torl.F'
23 yy=`echo $xx | sed 's/_r8/_r4/'`
24 echo "generate $xx from $yy"
25 sed -n "/^C \$$kWord:/p" $xx > $tmpOutF
26 sed -f $chg4to8 $yy | sed "/^C \$$kWord:/d" >> $tmpOutF
27 cmp -s $xx $tmpOutF
28 outp=$?
29 #echo $outp
30 if test $outp = 0 ; then
31 echo ' no changes in:' $xx
32 rm -f $tmpOutF
33 else
34 if test $showDiff = 1 ; then
35 echo "diff $xx $tmpOutF"
36 diff $xx $tmpOutF
37 fi
38 echo 'Update:' $xx
39 mv -i $tmpOutF $xx
40 fi
41
42
43 for xx in `ls mdsio_pass_r?tors.F`
44 do
45 yy=`echo $xx | sed 's/rs\.F$/rl.F/'`
46 echo "generate $xx from $yy"
47 sed -n "/^C \$$kWord:/p" $xx > $tmpOutF
48 sed 's/RL/RS/g' $yy | sed "/^C \$$kWord:/d" >> $tmpOutF
49 cmp -s $xx $tmpOutF
50 outp=$?
51 #echo $outp
52 if test $outp = 0 ; then
53 echo ' no changes in:' $xx
54 rm -f $tmpOutF
55 else
56 if test $showDiff = 1 ; then
57 echo "diff $xx $tmpOutF"
58 diff $xx $tmpOutF
59 fi
60 echo 'Update:' $xx
61 mv -i $tmpOutF $xx
62 fi
63 done
64
65 rm -f $chg4to8

  ViewVC Help
Powered by ViewVC 1.1.22