home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1992 March / Source_Code_CD-ROM_Walnut_Creek_March_1992.iso / usenet / altsrcs / 1 / 1953 < prev    next >
Text File  |  1990-12-28  |  2KB  |  50 lines

  1. Newsgroups: alt.sources
  2. From: avg@hq.demos.su (Vadim G. Antonov)
  3. Subject: [folklore] Re:  Ugly source contest
  4. Message-ID: <1990Oct14.203631.13763@math.lsa.umich.edu>
  5. Date: Sun, 14 Oct 90 20:36:31 GMT
  6.  
  7. Archive-name: ctags/14-Oct-90
  8. Original-posting-by: avg@hq.demos.su (Vadim G. Antonov)
  9. Original-subject: Re:  Ugly source contest
  10. Reposted-by: emv@math.lsa.umich.edu (Edward Vielmetti)
  11.  
  12. [Reposted from alt.folklore.computers.
  13. Comments on this service to emv@math.lsa.umich.edu (Edward Vielmetti).]
  14.  
  15. In article <ben.3004@epmooch.UUCP> ben@epmooch.UUCP (Rev. Ben A. Mesander) writes:
  16. >>In article <1990Oct12.192001.12739@tsa.co.uk> domo@tsa.co.uk (Dominic Dunlop) writes:
  17. >>Should be possible to create some pretty ugly
  18. >>regexps given that amount of rope to play with.  Prizes will be awarded
  19. >>if the sun cools significantly during processing...
  20. >
  21. >Here's one that's actually useful: it extracts C function declarations (all
  22. >lowercase...
  23. >^[a-z][a-z]*[\s\t]*.*([^;]*)[^;]*$
  24.  
  25.     Hm. Sometimes I use to hack with my C defines set simulating
  26.     Algol-68 :-). Needless to say that ctags barfs at it. Thus I
  27.     had to write my own ctags - hereafter THE ACTUAL CODE of it
  28.     (a part of Makefile). Enjoy.
  29.  
  30. tags:   $(SRC) $(HDR)
  31.     fgrep -v '&&&&&&&&&&&&&&&&&&&' $(SRC) $(HDR) | \
  32. |       sed -n 's/^\([^:]*\):\([a-zA-Z_][a-zA-Z0-9_ ]*\) \([a-zA-Z]
  33. |       [a-zA-Z0-9_]*\)\( *([a-zA-Z0-9_, ]*).*\)/\3`\1`?^\2 \3\4$$?
  34. |       /p; s/^\([^:]*\):\([a-zA-Z_][a-zA-Z0-9_]*\)\( *([a-zA-Z0-9_
  35. |       , ]*).*\)/\2`\1`?^\2\3$$?/p; s/^\([^:]*\):\(# *define  *\)\
  36. |       ([a-zA-Z_][0-9_a-zA-Z0-9_]*\)\(.*\)/\3`\1`?^\2\3\4$$?/p' | \
  37.     tr '`' '\011' | sort > tags
  38.  
  39. NOTE: all marked with | at the first column SHOULD BE PUT IN ONE LINE!
  40.       (Sorry I'm not sure your mailers can handle LONG lines).
  41.  
  42.     Try to use it - it handles #define-s unline original ctags :-)
  43.  
  44.     /This example is got from the actual Makefile of the kernel of D3
  45.     operating system/
  46.  
  47.     Vadim Antonov
  48.     DEMOS, Moscow, USSR
  49.     (It is a joke!)
  50.