#!/bin/sh
#
# SUMMARY:      Build feature tags for default C construct classes.
# USAGE:        <script-name> <etags-program> <tags-file-to-build> <root-dir-to-search> [... <root-dir-to-search>]
#
# AUTHOR:       Bob Weiner
# ORG:          Motorola, Inc.
# ORIG-DATE:     3-May-95 at 10:39:37
# LAST-MOD:     21-Oct-95 at 04:20:41 by Bob Weiner
# DESCRIPTION:  
# DESCRIP-END.

etags=$1
tags_file=$2
shift 2
\find $* -name SCCS -prune -o -name RCS -prune \
   -o -name "*.[mchMCH]" -print -o -name "*.[chCH][chpCHP]" -print \
   -o -name "*.[chCH][chpCHPx][pPx]" -print | ${etags} - -o- | tr '\014' '@' \
  | \egrep -h '^[^ 	]*\.[^ 	]*$|@|^(#define|struct|union|typedef|enum)[ \t]' \
  | tr '@\177\001' '\014@@' \
  | sed -e 's/^\([^ 	\n][^ 	\n]*\)\([^@]*\)@\([^@]*\)@.*/\1^^- \3^^\1\2/' \
        -e 's/^\(\([^ 	\n][^ 	\n]*\)[^@]*[ 	][*&]*\([^ 	\n(){};&*][^ 	\n(){};&*]*\).*\)@.*/\2^^- \3^^\1/' \
        -e 's/@.*//' -e 's/,[0-9][0-9]*//' -e 's/\^\^/@/g' \
        -e 's/^\(#define\)\(@.*(\)/[macro]\2/' -e 's/^#define/[constant]/' \
        -e 's/^enum/[enumeration]/' -e 's/^struct/[structure]/' \
        -e 's/^typedef/[type]/' -e 's/^union/[union]/' \
    > $tags_file

