Back to home page

MITgcm

 
 

    


Warning, /tools/convert_cpp_cmd2defines is written in an unsupported language. File is not indexed.

view on githubraw file Latest commit add29e06 on 2018-01-31 20:35:05 UTC
e47c9ea46d Jean*0001 #! /usr/bin/env bash
0c83fc374c Alis*0002 #
                0003 # Converts -Dmacro to #define macro
7f9b85c507 Jean*0004 #      and -Umacro to #undef macro
0c83fc374c Alis*0005 # on standard output
                0006 #
                0007 # Any options that do not take the form -D* or -U* are placed as comments.
                0008 #
                0009 # usage: convert_cpp_cmd2defines [-Dmacro1|-Umacro1] [...]
                0010 #
                0011 cat << EOF
b0438e3fcd Jean*0012 /*  Warning - this file is automatically generated - do NOT edit  */
0c83fc374c Alis*0013 /*
b0438e3fcd Jean*0014  Created by convert_cpp_cmd2defines with the following command line arguments:
0c83fc374c Alis*0015  $@
                0016 */
                0017 
                0018 EOF
                0019 
2fe032da30 Alis*0020 BARRIER=
                0021 
392108ad56 Alis*0022 # Process arguments
e47c9ea46d Jean*0023 for arg in "$@"
392108ad56 Alis*0024 do
                0025  case $arg in
2fe032da30 Alis*0026   -b*)
392108ad56 Alis*0027         BARRIER=`echo $arg | sed 's/-b//'`
                0028         echo "#ifndef ${BARRIER}"
                0029         echo "#define ${BARRIER}"
                0030         ;;
0c83fc374c Alis*0031   -D*)
392108ad56 Alis*0032         echo $arg | sed 's/-D/#define /' | sed 's/=/ /'
                0033         ;;
0c83fc374c Alis*0034   -U*)
392108ad56 Alis*0035         echo $arg | sed 's/-U/#undef  /' | sed 's/=/ /'
                0036         ;;
0c83fc374c Alis*0037   *)
392108ad56 Alis*0038         echo "/* " $arg " */"
                0039         ;;
0c83fc374c Alis*0040  esac
                0041 done
2fe032da30 Alis*0042 
                0043 if test ! "x${BARRIER}" = x ; then
                0044  echo "#endif /* ${BARRIER} */"
                0045 fi