#!/bin/sh
# shellcheck disable=SC1004

# $Id$

echo '/* Automatically generated by gen_defs.  Do not edit!'
echo ' *'
echo ' * NOTE:'
echo ' * This file should not be included in po/POTFILES.in.'
echo ' * The source OPS* files are listed there.'
echo ' */'
echo

for mode in help defs; do
	case $mode in
		help)
			echo "#ifdef HELP_C"
			echo "const char *HelpStrings[] = {"
			;;
		*)
			echo "enum {"
			;;
	esac
	for i in "$@"; do
		if test $mode = help; then
		  sed -e '/^OP_/!d' \
                      -e 's;^[^ ]* \(.*\);	\1,;' < "$i"
		else
		  sed -e '/^OP_/!d' \
                      -e 's;^\([^ ]*\).*;	\1,;' < "$i"
		fi
	done
	if test $mode = help; then
		echo '	NULL'
	else
		echo '	OP_MAX'
	fi
	echo "};"
	if test $mode = help; then
		echo "#endif /* MAIN_C */"
		echo ''
	fi
done

exit 0
