view lint/get-sources.sh @ 8:ec2b657edf13

Add explicit lint-comment-style fallthrough annotations. GCC now assumes that if you don't have these you're making a mistake, which is annoying. XXX: This changeset updates the AG output files only (by hand) and is XXX: abusive - rebuilding them will erase the change. However, I need XXX: to get things to build before I can try to get AG to issue the XXX: annotations itself, so this seems like a reasonable expedient.
author David A. Holland
date Mon, 30 May 2022 23:51:43 -0400
parents 13d2b8934445
children
line wrap: on
line source

#!/bin/sh
# get-sources.sh - retrieve list of source files
# usage: get-sources [-t] [-m] [-x]
#
# The idea of this script is that it suppresses .cpp and .h files that
# correspond to .syn files.

usage() {
    echo "Usage: $0 [-t] [-m] [-x] topdir" 1>&2
    echo "  -m    show main sources" 1>&2
    echo "  -t    show tools sources" 1>&2
    echo "  -x    show examples sources" 1>&2
}

DO_TOOLS=0
DO_MAIN=0
DO_EXAMPLES=0

DSET=0
FSET=0
while [ "x$1" != x ]; do
    case "$1" in
	-t) DO_TOOLS=1; FSET=1;;
	-m) DO_MAIN=1; FSET=1;;
	-x) DO_EXAMPLES=1; FSET=1;;
	-*) usage; exit 1;;
	*)
	    if [ -d "$1" -a $DSET = 0 ]; then
		TOPDIR="$1"
		DSET=1
	    else
		usage
		exit 1
	    fi
	;;
    esac
shift
done

if [ $FSET = 0 ]; then
    DO_TOOLS=1
    DO_MAIN=1
    DO_EXAMPLES=0
fi

if [ $DSET = 1 ]; then
    cd "$TOPDIR" || exit 1
    TOPDIR="${TOPDIR}/"
fi

############################################################

get() {
    (
	cd "$1"
	ls *.syn 2>/dev/null
	ls *.cpp *.hpp *.c *.h 2>/dev/null
	true
    ) | awk '
	{ basename=$1; sub("\\.[^\\.]*$", "", basename); }
	/\.syn$/ { hide[basename] = 1; doprint($1); next; }
	{ if (!hide[basename]) doprint($1); }
	function doprint(f) { printf "%s/%s\n", dir, f; }
    ' "dir=$1"
}

if [ $DO_TOOLS = 1 ]; then
    for DIR in cgbigen checksum helpgen insertsums; do
	get $DIR
    done
fi

if [ $DO_MAIN = 1 ]; then
    for DIR in \
		support agcore \
		guisupport icons dummygui vaclgui \
		ag1 \
		ag agcl \
		run \
    ; do
	get anagram/$DIR
    done
fi

if [ $DO_EXAMPLES = 1 ]; then
    for DIR in \
		include source \
    ; do
	get oldclasslib/$DIR
    done
    for DIR in \
		dsl fc ffcalc hw mpp rcalc \
    ; do
	get examples/$DIR
    done
fi

exit 0