0001 #!/bin/bash
0002 #script de translation des fichier fortran 64 bits -> linux 32 bits
0003 cp $1 $2
0004 echo $1 will be translated
0005 cat $2 | sed -e 's/integer\*8/integer/' > $2.tmp
0006 cat $2.tmp | sed -e 's/INTEGER\*8/INTEGER/' > $2
0007 grep -i "integer\*8" $2 && echo "Probleme de translation de $2"
0008 grep -i "integer \*8" $2 && echo "Probleme de translation de $2 (espace avant *)"
0009 grep -i "integer\* 8" $2 && echo "Probleme de translation de $2(espace apres *)"
0010 cat $2 | sed -e 's/KMIN0(/MIN0(/' > $2.tmp
0011 cat $2.tmp | sed -e 's/kmin0(/min0(/' > $2
0012 cat $2 | sed -e 's/KMAX0(/MAX0(/' > $2.tmp
0013 cat $2.tmp | sed -e 's/kmax0(/max0(/' > $2
0014 cat $2 | sed -e 's/DMIN0(/MIN0(/' > $2.tmp
0015 cat $2.tmp | sed -e 's/dmin0(/min0(/' > $2
0016 cat $2 | sed -e 's/DMAX0(/MAX0(/' > $2.tmp
0017 cat $2.tmp | sed -e 's/dmax0(/max0(/' > $2
0018 cat $2 | sed -e 's/NINT(/INT(/' > $2.tmp
0019 cat $2.tmp | sed -e 's/nint(/int(/' > $2
0020 cat $2 | sed -e 's/DMAX1(/MAX(/' > $2.tmp
0021 cat $2.tmp | sed -e 's/dmax1(/max(/' > $2
0022 cat $2 | sed -e 's/DMAX(/MAX(/' > $2.tmp
0023 cat $2.tmp | sed -e 's/dmax(/max(/' > $2
0024 cat $2 | sed -e 's/MAX0(/MAX(/' > $2.tmp
0025 cat $2.tmp | sed -e 's/max0(/max(/' > $2
0026 cat $2 | sed -e 's/DMIN1(/MIN(/' > $2.tmp
0027 cat $2.tmp | sed -e 's/dmin1(/min(/' > $2
0028 cat $2 | sed -e 's/DMIN(/MIN(/' > $2.tmp
0029 cat $2.tmp | sed -e 's/dmin(/min(/' > $2
0030 cat $2 | sed -e 's/MIN0(/MIN(/' > $2.tmp
0031 cat $2.tmp | sed -e 's/min0(/min(/' > $2
0032 cat $2 | sed -e 's/DRAND(/RAND(/' > $2.tmp
0033 cat $2.tmp | sed -e 's/drand(/rand(/' > $2
0034 cat $2 | sed -e 's/c@linux/ /' > $2.tmp
0035 cat $2.tmp | sed -e 's/C@LINUX/ /' > $2
0036
0037 grep "mexFunction" $2 | grep -i "subroutine" > /dev/null || \
0038 echo "$2 n'est pas un mexfile, pas de controles type mexfile"
0039 grep "mexFunction" $2 | grep -i "subroutine" > /dev/null || exit
0040
0041 grep "mxGetN" $2 | grep -i "integer" > /dev/null || \
0042 echo "Il manque la declaration de mxGetN dans $2"
0043 grep "mxGetM" $2 | grep -i "integer" > /dev/null || \
0044 echo "Il manque la declaration de mxGetM dans $2"
0045 grep -i "plhs" $2 | grep -i "integer" > /dev/null || \
0046 echo "Il manque la declaration de plhs(*) dans $2"
0047 grep -i "prhs" $2 | grep -i "integer" > /dev/null || \
0048 echo "Il manque la declaration de plhs(*) dans $2"
0049 grep -i "nlhs" $2 | grep -i "integer" > /dev/null || \
0050 echo "Il manque la declaration de nlhs dans $2"
0051 grep -i "nrhs" $2 | grep -i "integer" > /dev/null || \
0052 echo "Il manque la declaration de nrhs dans $2"
0053 grep "mxCreateFull" $2 | grep -i "integer" > /dev/null || \
0054 echo "Il manque la declaration de mxCreateFull dans $2"
0055 grep "mxGetPr" $2 | grep -i "integer" > /dev/null || \
0056 echo "Il manque la declaration de mxGetPr dans $2"
0057
0058 rm -rf *.tmp
0059
0060 exit
0061