1#!/usr/bin/env bash 2set -e 3 4if [ -z "$srcdir" ] 5then 6 srcdir=$(dirname "$0") 7fi 8 9# extract enum definition 10dispatch_list=$(sed '/__GLXdispatchIndex/,/__GLXdispatchIndex/!d' \ 11 "$srcdir"/../g_glxglvnddispatchindices.h) 12 13# extract values inside of enum 14dispatch_list=$(sed '1d;$d' <<< "$dispatch_list") 15 16# remove indentation 17dispatch_list=$(sed 's/^\s\+//' <<< "$dispatch_list") 18 19# extract function names 20dispatch_list=$(sed 's/DI_//;s/,//' <<< "$dispatch_list") 21 22# same for commented functions, we want to keep them sorted too 23dispatch_list=$(sed 's#// ##;s/ implemented by [a-z]\+//' <<< "$dispatch_list") 24 25# remove LAST_INDEX, as it will not be in alphabetical order 26dispatch_list=$(sed '/LAST_INDEX/d' <<< "$dispatch_list") 27 28sorted=$(LC_ALL=C sort <<< "$dispatch_list") 29 30test "$dispatch_list" = "$sorted" 31