diff options
author | William Joye <wjoye@cfa.harvard.edu> | 2016-10-17 15:22:52 (GMT) |
---|---|---|
committer | William Joye <wjoye@cfa.harvard.edu> | 2016-10-17 15:22:52 (GMT) |
commit | 7dd9b970cec6832b8f6118dc2dd91a08d2836648 (patch) | |
tree | 4b3c86596ab87f35a3c6213397da07afe1e24d3e /ast/cexpand | |
parent | d7bf7c61e8507e3cf51f195392c0f41f27ae18d8 (diff) | |
parent | 7fde2daeed593684120d75de07598154f3ddaf2c (diff) | |
download | blt-7dd9b970cec6832b8f6118dc2dd91a08d2836648.zip blt-7dd9b970cec6832b8f6118dc2dd91a08d2836648.tar.gz blt-7dd9b970cec6832b8f6118dc2dd91a08d2836648.tar.bz2 |
Merge commit '7fde2daeed593684120d75de07598154f3ddaf2c' as 'ast'
Diffstat (limited to 'ast/cexpand')
-rwxr-xr-x | ast/cexpand | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/ast/cexpand b/ast/cexpand new file mode 100755 index 0000000..b40957a --- /dev/null +++ b/ast/cexpand @@ -0,0 +1,32 @@ +#!/bin/tcsh +#+ + +# Name: +# cexpand + +# Purpose: +# Expand a C source file using the C pre-processor and re-format it +# into a readable form. The output is written to a file with the same +# base-name as the input file, but with a file type of ".cpp". + +# Usage: +# % cexpand fred.c + +#- + +if( "$1" == "" ) then + echo "Usage: cexpand <file.c>" + exit +endif + +set file = `basename $1 .c` +cpp -CC -P $file.c -DTHREAD_SAFE -DHAVE_CONFIG_H -I. -I.. -I/star/include > aaxx +indent aaxx -kr -o bbxx +cat bbxx | sed -e 's#/\*#\n/\*#g' > ccxx +cat ccxx | cexpand.pl > ddxx +indent ddxx -kr -o $file.cpp +rm aaxx bbxx ccxx ddxx + +echo "Output in $file.cpp" +echo "" + |