forked from cory/tildefriends
Cory McWilliams
79022e1e1f
git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@3621 ed5197a5-7fde-0310-b194-c3ffbd925b24
22 lines
515 B
Plaintext
22 lines
515 B
Plaintext
# AS_CASE(WORD, [PATTERN1], [IF-MATCHED1]...[DEFAULT])
|
|
# ----------------------------------------------------
|
|
# Expand into
|
|
# | case WORD in
|
|
# | PATTERN1) IF-MATCHED1 ;;
|
|
# | ...
|
|
# | *) DEFAULT ;;
|
|
# | esac
|
|
m4_define([_AS_CASE],
|
|
[m4_if([$#], 0, [m4_fatal([$0: too few arguments: $#])],
|
|
[$#], 1, [ *) $1 ;;],
|
|
[$#], 2, [ $1) m4_default([$2], [:]) ;;],
|
|
[ $1) m4_default([$2], [:]) ;;
|
|
$0(m4_shiftn(2, $@))])dnl
|
|
])
|
|
m4_defun([AS_CASE],
|
|
[m4_ifval([$2$3],
|
|
[case $1 in
|
|
_AS_CASE(m4_shift($@))
|
|
esac])])
|
|
|