1e66f31c5Sopenharmony_ci# AS_CASE(WORD, [PATTERN1], [IF-MATCHED1]...[DEFAULT]) 2e66f31c5Sopenharmony_ci# ---------------------------------------------------- 3e66f31c5Sopenharmony_ci# Expand into 4e66f31c5Sopenharmony_ci# | case WORD in 5e66f31c5Sopenharmony_ci# | PATTERN1) IF-MATCHED1 ;; 6e66f31c5Sopenharmony_ci# | ... 7e66f31c5Sopenharmony_ci# | *) DEFAULT ;; 8e66f31c5Sopenharmony_ci# | esac 9e66f31c5Sopenharmony_cim4_define([_AS_CASE], 10e66f31c5Sopenharmony_ci[m4_if([$#], 0, [m4_fatal([$0: too few arguments: $#])], 11e66f31c5Sopenharmony_ci [$#], 1, [ *) $1 ;;], 12e66f31c5Sopenharmony_ci [$#], 2, [ $1) m4_default([$2], [:]) ;;], 13e66f31c5Sopenharmony_ci [ $1) m4_default([$2], [:]) ;; 14e66f31c5Sopenharmony_ci$0(m4_shiftn(2, $@))])dnl 15e66f31c5Sopenharmony_ci]) 16e66f31c5Sopenharmony_cim4_defun([AS_CASE], 17e66f31c5Sopenharmony_ci[m4_ifval([$2$3], 18e66f31c5Sopenharmony_ci[case $1 in 19e66f31c5Sopenharmony_ci_AS_CASE(m4_shift($@)) 20e66f31c5Sopenharmony_ciesac])]) 21e66f31c5Sopenharmony_ci 22