Created
March 3, 2012 03:33
-
-
Save skyscribe/1964161 to your computer and use it in GitHub Desktop.
generate gcc tags from header
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
if [ $# -eq 0 ];then | |
dir=. | |
else | |
dir=$1 | |
fi | |
#Substitute scripts | |
cat > .edit.sed <<- EOF | |
s/\b_GLIBCXX_BEGIN_NAMESPACE\b\s*\(\s*(\w+)\s*\)/namespace \1{/g | |
s/_GLIBCXX_BEGIN_NESTED_NAMESPACE\s*\(\s*std\s*,\s*_GLIBCXX_STD_[DP]\s*\)/namespace std{/g | |
s/\b_GLIBCXX_END_NAMESPACE\b/}/g | |
s/\b_GLIBCXX_END_(NESTED_\?NAMESPACE\b/}/g | |
EOF | |
count=0 | |
cols=`tput cols` | |
cols=`echo "$cols - 8"|bc` | |
for file in `find $dir -type f`;do | |
if [ "T"$file != "T"$0 ];then | |
sed -nf ".edit.sed" $file | |
count=`echo "$count+1"|bc` | |
echo -ne "=" | |
if [ `echo "$count%$cols"|bc` -eq 0 ];then | |
echo " $count" | |
fi | |
fi | |
done | |
echo "Processed $count files!" | |
rm -fr .edit.sed | |
# Generate ctag file | |
ctags -R --c++-kinds=+p --fields=+iaS --extra=+q | |
echo "generated tag file!" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment