summaryrefslogtreecommitdiffstats
path: root/gen_defs
blob: d9c9963887ddf60ead048a49ac3af67f06204a02 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#!/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