Re: Program to set up tags for INFORMIX-4gl program
Posted in 1993
Quoting bmk Bradley Kuhn... } } Does anyone have a program (however crude) that will make tag tables for } INFORMIX-4gl programs? Please mail me the source or and ftp and/or listserver } where I can get it. } Assuming that you mean "tags" for the vi editor, here is 4gltags... BTW, if the "awk" on your machine chokes, try "nawk" or "gawk". Here --------- Snip Here --------- Snip Here --------- Snip Here --------- Snip : # 4gltags - written by Stu Heiss - 02/22/91 tmp=/tmp/$$tags trap 'rm -f $tmp;exit' 0 1 2 3 15 usage() { echo "usage: $0 [-au] file ..."; exit 1; } uflag=false aflag=false set -- `getopt ua $*` || usage for i do case "$i" in -a) aflag=true;shift;; -u) uflag=true;shift;; --) shift;break;; esac done test $# -lt 1 && usage files="$@" awk ' /end[ ]*FUNCTION/ { next } /FUNCTION/ { save=$0 sub(/#.*$/,"") # strip trailing comments if ((i=index($0,"FUNCTION"))==0) next s=substr($0,i+8) i=index(s,"(") # must be followed by open paren if(i==0) next token=substr(s,1,i-1) # function name sub(/^[ ]/,"",token) # strip leading/trailing blanks sub(/[ ]$/,"",token) line="" while((i = index(save,"\\\\"))>0) { line = line substr(save,1,i-1) "\\\\\\\\" save = substr(save,i+1) } if (tokens[token]) { if (tokens[token] == FILENAME) printf("Duplicate function in file %s, line %d: %s\\nSecond entry ignored\\n", FILENAME, FNR, token) | "cat >&2" else printf("Duplicate function in files %s and %s: %s (Warning only)\\n", FILENAME, tokens[token], token) | "cat >&2" continue } tokens[token] = FILENAME printf("%s\\t%s\\t/^%s%s$/\\n", token, FILENAME, line, save) next } { next } ' $files | sort > $tmp $uflag && { for file in $files do mv tags OTAGS fgrep -v " ${file} " OTAGS > tags rm OTAGS done aflag=true } if $aflag;then cat $tmp >> tags else cat $tmp > tags fi Here --------- Snip Here --------- Snip Here --------- Snip Here --------- Snip DAS -- David Snyder @ Snide Computer Services - Folcroft, PA Current Release is db4glgen-3.9 UUCP: ..!uunet!das13!dave INTERNET: dave.snyder@snide.com