/[MITgcm]/MITgcm/tools/convert_cpp_cmd2defines
ViewVC logotype

Annotation of /MITgcm/tools/convert_cpp_cmd2defines

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


Revision 1.6 - (hide annotations) (download)
Fri Jul 6 18:53:14 2012 UTC (11 years, 9 months ago) by jmc
Branch: MAIN
CVS Tags: checkpoint63q, checkpoint63r
Changes since 1.5: +3 -4 lines
one comments line (instead of 2)

1 jmc 1.5 #! /usr/bin/env bash
2 adcroft 1.1 #
3     # Converts -Dmacro to #define macro
4 jmc 1.6 # and -Umacro to #undef macro
5 adcroft 1.1 # on standard output
6     #
7     # Any options that do not take the form -D* or -U* are placed as comments.
8     #
9     # usage: convert_cpp_cmd2defines [-Dmacro1|-Umacro1] [...]
10     #
11 jmc 1.6 # $Header: /u/gcmpack/MITgcm/tools/convert_cpp_cmd2defines,v 1.5 2010/05/24 12:03:51 jmc Exp $
12 adcroft 1.2 # $Name: $
13 adcroft 1.1
14     cat << EOF
15     /*
16 jmc 1.6 This file created by convert_cpp_cmd2defines with the following command line arguments:
17 adcroft 1.1 $@
18     */
19    
20     EOF
21    
22 adcroft 1.2 BARRIER=
23    
24 adcroft 1.3 # Process arguments
25 jmc 1.5 for arg in "$@"
26 adcroft 1.3 do
27     case $arg in
28 adcroft 1.2 -b*)
29 adcroft 1.3 BARRIER=`echo $arg | sed 's/-b//'`
30     echo "#ifndef ${BARRIER}"
31     echo "#define ${BARRIER}"
32     ;;
33 adcroft 1.1 -D*)
34 adcroft 1.3 echo $arg | sed 's/-D/#define /' | sed 's/=/ /'
35     ;;
36 adcroft 1.1 -U*)
37 adcroft 1.3 echo $arg | sed 's/-U/#undef /' | sed 's/=/ /'
38     ;;
39 adcroft 1.1 *)
40 adcroft 1.3 echo "/* " $arg " */"
41     ;;
42 adcroft 1.1 esac
43     done
44 adcroft 1.2
45     if test ! "x${BARRIER}" = x ; then
46     echo "#endif /* ${BARRIER} */"
47     fi

  ViewVC Help
Powered by ViewVC 1.1.22