[folklore] Re: Ugly source contest

Vadim G. Antonov avg at hq.demos.su
Mon Oct 15 06:36:31 AEST 1990


Archive-name: ctags/14-Oct-90
Original-posting-by: avg at hq.demos.su (Vadim G. Antonov)
Original-subject: Re:  Ugly source contest
Reposted-by: emv at math.lsa.umich.edu (Edward Vielmetti)

[Reposted from alt.folklore.computers.
Comments on this service to emv at math.lsa.umich.edu (Edward Vielmetti).]

In article <ben.3004 at epmooch.UUCP> ben at epmooch.UUCP (Rev. Ben A. Mesander) writes:
>>In article <1990Oct12.192001.12739 at tsa.co.uk> domo at 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!)



More information about the Alt.sources mailing list