Xref: utzoo comp.unix.questions:19975 gnu.utils.bug:841 comp.editors:1337 alt.sources:1516 Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!uwm.edu!cs.utexas.edu!uunet!mcsun!hp4nl!star.cs.vu.nl!maart From: maart@cs.vu.nl (Maarten Litmaath) Newsgroups: comp.unix.questions,gnu.utils.bug,comp.editors,alt.sources Subject: Re: tag files for preprocessor macros? Message-ID: <5447@star.cs.vu.nl> Date: 16 Feb 90 23:52:51 GMT References: <1345@zipeecs.umich.edu> Sender: news@cs.vu.nl Reply-To: maart@cs.vu.nl (Maarten Litmaath) Organization: VU Informatika, Amsterdam, the Netherlands Lines: 43 In article <1345@zipeecs.umich.edu>, brian@dip.eecs.umich.edu (Brian Holtz) writes: )Is there a tool like ctags or etags that also generates tags for )preprocessor-#define'd symbols and macros? --------------------cut here-------------------- #!/bin/sh # @(#)cpptags 1.3 90/01/05 Maarten Litmaath tags=tags case $1 in -f) tags=$2 shift 2 esac case $# in 0) exit esac tab=" " expr="^[ $tab]*#[ $tab]*define[ $tab]*\\([A-Za-z_][A-Za-z_0-9]*\\).*" AWK=' $1 == tag { print "Duplicate entry in files " $2 " and " file ": " $1 } { tag = $1 file = $2 } ' for i do sed -e "/$expr/!d" -e 's-[\\/]-\\&-g' \ -e "s|$expr|\\1$tab$i$tab/^&\$/|" $i done | sort | tee $tags | awk "$AWK" >&2 --------------------cut here-------------------- -- The meek get the earth, Henry the moon, the rest of us have other plans. | Maarten Litmaath @ VU Amsterdam: maart@cs.vu.nl, uunet!mcsun!botter!maart