summaryrefslogtreecommitdiffstats
path: root/ast/cexpand
diff options
context:
space:
mode:
authorWilliam Joye <wjoye@cfa.harvard.edu>2018-01-09 19:06:55 (GMT)
committerWilliam Joye <wjoye@cfa.harvard.edu>2018-01-09 19:06:55 (GMT)
commit01e0ebfe59d9028b0246ec4a549bd7528ada94eb (patch)
treea6c5b54db03177a1c8f3e7fb531990dfbc7bae39 /ast/cexpand
parentd64cf9c0bd23e752867b149be636d1bbd4501cf4 (diff)
downloadblt-01e0ebfe59d9028b0246ec4a549bd7528ada94eb.zip
blt-01e0ebfe59d9028b0246ec4a549bd7528ada94eb.tar.gz
blt-01e0ebfe59d9028b0246ec4a549bd7528ada94eb.tar.bz2
update ast 8.6.2
Diffstat (limited to 'ast/cexpand')
-rwxr-xr-xast/cexpand32
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 ""
+