[PATCH] make (vim) tags

Pete Wyckoff (wyckoff@ca.sandia.gov)
Tue, 9 Nov 1999 11:20:22 -0800


Here's my version of a kernel tags generator to be used with vim.

One interesting part is limiting the set of searched files to just some
architectures, and culling out drivers you'll never want to look at.
The other interesting bit is telling ctags to ignore certain
identifiers so it doesn't generate 50 entries for __initdata, e.g.

New file, presented as a diff.

-- Pete

--- linux/scripts/dotags Wed Dec 31 16:00:00 1969
+++ linux-o/scripts/dotags Tue Nov 9 11:00:01 1999
@@ -0,0 +1,110 @@
+#!/bin/bash
+#
+# dotags - tags file generator, vi-style using ctags
+# <wyckoff@ca.sandia.gov>
+#
+# Exuberant ctags is distributed with vim <http://www.vim.org>, or
+# may be found separately at <http://darren.hiebert.com/ctags>.
+#
+# Make my favorite tags file, filtering out stuff I don't use.
+# and removing qualifiers like __initdata where they get in the way of
+# tagging.
+#
+# There are two settings below which configure your favorite things depending
+# on architecture and top-level drivers.
+#
+##
+#
+# Modify arch variable to include just certain architectures. Leave blank
+# or comment out to include all arches.
+#
+# i386 only
+arch=i386
+# i386 and alpha
+#arch="i386 alpha"
+# all arches
+#arch=
+#
+# Modify driver variable to include certain drivers, or nodriver
+# variable to exclude certain ones. Empty (or undefined) for both means
+# include all drivers. Do not set both.
+#
+# ignore files for stuff I never use
+nodriver="acorn ap1000 atm dio fc4 i2o isdn macintosh nubus pnp sbus sgi tc zorro"
+# include just your favorites
+#driver="block char net"
+#
+## end of modifiable vars
+
+#
+# fill noarches, default all of them, i.e. exclude nothing
+#
+noarches=
+if [ -n "$arch" ] ; then
+ noarches=$(ls arch)
+ for i in $arch ; do # remove them one at a time from the exclude list
+ if echo $noarches | egrep -q "\<$i\>" ; then
+ noarches=$(echo $noarches | sed s/$i//)
+ else
+ echo $0: Arch $i not found.
+ # but keep going
+ fi
+ done
+fi
+
+#
+# fill nodrivers
+#
+nodrivers=
+alldriver=$(ls drivers | sed s/Makefile//)
+# driver=, nodriver= --> nodrivers=
+# driver=x, nodriver=x --> error
+# nodriver=x --> nodrivers=x
+# driver=x --> nodrivers=all-but-x
+if [ -n "$nodriver" ] ; then
+ if [ -n "$driver" ] ; then
+ echo "$0: Can't have both driver and nodriver set."
+ exit 1
+ fi
+ for i in $nodriver ; do
+ if echo $alldriver | egrep -q "\<$i\>" ; then
+ nodrivers="$nodrivers $i"
+ else
+ echo "$0: Driver $i not found."
+ fi
+ done
+elif [ -n "$driver" ] ; then
+ nodrivers=$alldriver
+ for i in $driver ; do
+ if echo $nodrivers | egrep -q "\<$i\>" ; then
+ nodrivers=$(echo $nodrivers | sed s/$i//)
+ else
+ echo "$0: Driver $i not found."
+ fi
+ done
+fi
+
+#
+# create the find command
+#
+find="find . -name *.[ch]"
+# My find does not seem to understand | or () in regexps, so list everything
+# one at a time.
+if [ -n "$noarches" ] ; then
+ for i in $noarches ; do
+ find="$find ! -regex \"^\.\/arch\/$i\/.*\""
+ find="$find ! -regex \"^\.\/include/asm-$i\/.*\""
+ done
+fi
+if [ -n "$nodrivers" ] ; then
+ for i in $nodrivers ; do
+ find="$find ! -regex \"^\.\/drivers\/$i\/.*\""
+ done
+fi
+
+ignores=__initdata,__initlocaldata,__exitdata,EXPORT_SYMBOL,EXPORT_SYMBOL_NOVERS
+#
+# find the desired files and feed them to ctags
+#
+eval $find | exec ctags -L - --totals=yes -I $ignores
+exit 0

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/