From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,3692e2fca5c259f8 X-Google-Attributes: gid103376,public From: stt@houdini.camb.inmet.com (Tucker Taft) Subject: Re: adatags? Date: 1997/09/11 Message-ID: #1/1 X-Deja-AN: 271609351 Sender: news@inmet.camb.inmet.com (USENET news) References: <5v8k6n$pbs$1@netty.york.ac.uk> X-Nntp-Posting-Host: houdini.camb.inmet.com Organization: Intermetrics, Inc. Newsgroups: comp.lang.ada Date: 1997-09-11T00:00:00+00:00 List-Id: Oliver Kiddle (opk101@york.ac.uk) wrote: : Does anyone know if there is a program like ctags except for Ada. A : friend of mine thinks that there was such a program, called adatags : which was posted to this group a while ago. I've tried, archie, ftp : search, several web searches and have searched the PAL and Ada home : pages with no success. Here is my personal version of "adatags". Use it as you see fit. Note that there are two "awk" scripts as well, adatags.inx and adatags.awk. Adatags allows you to use the name in all lower case, or in the same case as was used at the point of declaration. It creates entries for all program units and all types. It is of course confused by overloading ;-). -Tucker Taft stt@inmet.com Intermetrics, Inc. Burlington, MA ------------------------ adatags --------------------- #!/bin/csh -f set args = () foreach a ($*) switch ($a) case "-a": set appflg breaksw case "-x": set indexflg breaksw case "-u": set updateflg breaksw case "-*": echo "$a : Unrecognized switch" set args = () break default: set args = ($args $a) breaksw endsw end set mypath = $0 set myname = $mypath:t set mydir = $mypath:h if ($mydir == $mypath) set mydir = "." if ($#args == 0) then echo "Usage: $myname [ -a -x -u ] file ..." exit -1 endif if ($?indexflg) then awk -f $mydir/adatags.inx $args | sort exit 0 endif if ($?updateflg) then echo >> tags set sedargs = "" foreach a ($args) set sedargs = ($sedargs:q -e "/ $a ?/d") end sed $sedargs:q tags > tags.$$ mv tags.$$ tags set appflg endif if ($?appflg) then awk -f $mydir/adatags.awk $args | sort tags - > tags.$$ mv tags.$$ tags else awk -f $mydir/adatags.awk $args | sort > tags endif --------------------- adatags.awk ------------------------- BEGIN { low["A"] = "a" low["B"] = "b" low["C"] = "c" low["D"] = "d" low["E"] = "e" low["F"] = "f" low["G"] = "g" low["H"] = "h" low["I"] = "i" low["J"] = "j" low["K"] = "k" low["L"] = "l" low["M"] = "m" low["N"] = "n" low["O"] = "o" low["P"] = "p" low["Q"] = "q" low["R"] = "r" low["S"] = "s" low["T"] = "t" low["U"] = "u" low["V"] = "v" low["W"] = "w" low["X"] = "x" low["Y"] = "y" low["Z"] = "z" } /^[ ]*([Pp]rocedure|[Ff]unction|[Tt]ask|[Pp]rotected|[Pp]ackage|[Tt]ype|[Ss]ub[Tt]ype)/ { if ($2 ~ /^[Tt]ype$/ || $2 ~ /^[Bb]ody$/) { id = $3 } else { id = $2 } split(id, idar, "("); id = idar[1]; split(id, idar, ";"); id = idar[1]; if (id ~ /^["A-Za-z]/ && $0 !~ /is separate/) { if (length($0) < 50) lin = $0 "$"; else lin = substr($0, 1, 50); if (lin ~ /[?*.\\+^]/) { newlin = ""; ln = length(lin); for (i = 1; i <= ln; i++) { j = substr(lin, i, 1); if (j ~ /[?*.\\+^]/) newlin = newlin "\\" j; else newlin = newlin j; } lin = newlin; } if (id ~ /[A-Z]/) { newid = ""; ln = length(id); for (i = 1; i <= ln; i++) { j = substr(id,i,1); if (j ~ /[A-Z]/) newid = newid low[j]; else newid = newid j; } printf("%s %s ?^%s?\n", newid, FILENAME, lin); } printf("%s %s ?^%s?\n", id, FILENAME, lin); } } ---------------------- adatags.inx ---------------------- { if (FILENAME != savedfn) { base = NR-1 savedfn = FILENAME } } /^[ ]*([Pp]rocedure|[Ff]unction|[Tt]ask|[Pp]rotected|[Pp]ackage|[Tt]ype|[Ss]ub[Tt]ype)/ { if ($2 ~ /^[Tt]ype$/ || $2 ~ /^[Bb]ody$/) { id = $3 } else { id = $2 } split(id, idar, "("); id = idar[1]; if (id ~ /[A-Za-z].*/) { x = $1" "$2 front = sprintf("%-15s %4d %-16s", id, NR-base, FILENAME); max = 78 - length(front); for (i = 3; i <= NF; i++) { y = x" "$i if (length(y) > max) break; x = y } print front, x; } } ----------------------------- end of adatags.inx ---------------- : Cheers : Oliver Kiddle : -- : __ : / \|. _ _ |_/. _| _|| _ E-mail: opk101@york.ac.uk : \__/||\/(-| | \|(_|(_||(- Web: http://www.york.ac.uk/~opk101/ -- -Tucker Taft stt@inmet.com http://www.inmet.com/~stt/ Intermetrics, Inc. Burlington, MA USA