Path: utzoo!utgpu!cs.utexas.edu!uwm.edu!caen!math.lsa.umich.edu!math.lsa.umich.edu!emv From: avg@hq.demos.su (Vadim G. Antonov) Newsgroups: alt.sources Subject: [folklore] Re: Ugly source contest Message-ID: <1990Oct14.203631.13763@math.lsa.umich.edu> Date: 14 Oct 90 20:36:31 GMT References: <15827@yunexus.YorkU.CA> <20414@ttidca.TTI.COM> <1990Oct12.192001.12739@tsa.co.uk> <1990Oct14.155310.2173@hq.demos.su> Sender: emv@math.lsa.umich.edu (Edward Vielmetti) Reply-To: avg@hq.demos.su (Vadim G. Antonov) Followup-To: alt.folklore.computers Organization: DEMOS, Moscow, USSR Lines: 43 X-Original-Newsgroups: alt.folklore.computers Archive-name: ctags/14-Oct-90 Original-posting-by: avg@hq.demos.su (Vadim G. Antonov) Original-subject: Re: Ugly source contest Reposted-by: emv@math.lsa.umich.edu (Edward Vielmetti) [Reposted from alt.folklore.computers. Comments on this service to emv@math.lsa.umich.edu (Edward Vielmetti).] In article ben@epmooch.UUCP (Rev. Ben A. Mesander) writes: >>In article <1990Oct12.192001.12739@tsa.co.uk> domo@tsa.co.uk (Dominic Dunlop) writes: >>Should be possible to create some pretty ugly >>regexps given that amount of rope to play with. Prizes will be awarded >>if the sun cools significantly during processing... > >Here's one that's actually useful: it extracts C function declarations (all >lowercase... >^[a-z][a-z]*[\s\t]*.*([^;]*)[^;]*$ Hm. Sometimes I use to hack with my C defines set simulating Algol-68 :-). Needless to say that ctags barfs at it. Thus I had to write my own ctags - hereafter THE ACTUAL CODE of it (a part of Makefile). Enjoy. tags: $(SRC) $(HDR) fgrep -v '&&&&&&&&&&&&&&&&&&&' $(SRC) $(HDR) | \ | sed -n 's/^\([^:]*\):\([a-zA-Z_][a-zA-Z0-9_ ]*\) \([a-zA-Z] | [a-zA-Z0-9_]*\)\( *([a-zA-Z0-9_, ]*).*\)/\3`\1`?^\2 \3\4$$? | /p; s/^\([^:]*\):\([a-zA-Z_][a-zA-Z0-9_]*\)\( *([a-zA-Z0-9_ | , ]*).*\)/\2`\1`?^\2\3$$?/p; s/^\([^:]*\):\(# *define *\)\ | ([a-zA-Z_][0-9_a-zA-Z0-9_]*\)\(.*\)/\3`\1`?^\2\3\4$$?/p' | \ tr '`' '\011' | sort > tags NOTE: all marked with | at the first column SHOULD BE PUT IN ONE LINE! (Sorry I'm not sure your mailers can handle LONG lines). Try to use it - it handles #define-s unline original ctags :-) /This example is got from the actual Makefile of the kernel of D3 operating system/ Vadim Antonov DEMOS, Moscow, USSR (It is a joke!)