summaryrefslogblamecommitdiffstats
path: root/gen_defs
blob: d9c9963887ddf60ead048a49ac3af67f06204a02 (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11
12
         
                           
 

      






                                                             





                                                            


                                     

                          
                         
                                          

                                                            
                    

                                                            
                  











                                          

      
#!/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