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

Contents of /MITgcm/tools/convert_cpp_cmd2defines

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


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

1 #! /usr/bin/env bash
2 #
3 # Converts -Dmacro to #define macro
4 # and -Umacro to #undef macro
5 # 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 # $Header: /u/gcmpack/MITgcm/tools/convert_cpp_cmd2defines,v 1.5 2010/05/24 12:03:51 jmc Exp $
12 # $Name: $
13
14 cat << EOF
15 /*
16 This file created by convert_cpp_cmd2defines with the following command line arguments:
17 $@
18 */
19
20 EOF
21
22 BARRIER=
23
24 # Process arguments
25 for arg in "$@"
26 do
27 case $arg in
28 -b*)
29 BARRIER=`echo $arg | sed 's/-b//'`
30 echo "#ifndef ${BARRIER}"
31 echo "#define ${BARRIER}"
32 ;;
33 -D*)
34 echo $arg | sed 's/-D/#define /' | sed 's/=/ /'
35 ;;
36 -U*)
37 echo $arg | sed 's/-U/#undef /' | sed 's/=/ /'
38 ;;
39 *)
40 echo "/* " $arg " */"
41 ;;
42 esac
43 done
44
45 if test ! "x${BARRIER}" = x ; then
46 echo "#endif /* ${BARRIER} */"
47 fi

  ViewVC Help
Powered by ViewVC 1.1.22