File: catim

package info (click to toggle)
icmake 13.05.01-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 7,132 kB
  • sloc: cpp: 11,595; fortran: 883; makefile: 853; sh: 546; pascal: 342
file content (25 lines) | stat: -rwxr-xr-x 782 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#!/bin/bash

IFS="
"

echo "//    This file does not contain additional comment.
//    Comment is provided in the distribution files under ./scripts
"

while read -r line ; do
    echo "$line" | grep '^#include "'$1'/' > /dev/null  # find the #includes
    if [ $? -ne 0 ] ; then                              # no include
        echo "$line"
    else                                                # found #include
        line=`echo "$line" | sed 's|#include "'$1'/\([a-z]\+\).*|\1|'`
        cat $1/$line
    fi
done | sed ' 
    s|\s*//[^"].*||
    s|\s*//\s*$||' | grep -v '^$' | sed 's|%%|//|g' 

# remove spaces followed by // until the end of the line

#   remove end of line comment, remove empty lines, but keep
#   string constants (may not contain \" escape characters)