diff options
Diffstat (limited to 'checks/229.improved_c')
-rw-r--r-- | checks/229.improved_c | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/checks/229.improved_c b/checks/229.improved_c new file mode 100644 index 0000000..7e1f47f --- /dev/null +++ b/checks/229.improved_c @@ -0,0 +1,46 @@ +dnl @ ../doc/m4.texinfo:8347: Origin of test +dnl @ expected status: 0 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007, 2008, 2009 Free Software +dnl @ Foundation, Inc. +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +include(`stack_sep.m4') +dnl @result{} +define(`copy', `ifdef(`$2', `errprint(`$2 already defined +')m4exit(`1')', + `stack_foreach_sep(`$1', `pushdef(`$2',', `)')')')dnl +pushdef(`a', `1')pushdef(`a', defn(`divnum')) +dnl @result{} +copy(`a', `b') +dnl @result{} +b +dnl @result{}0 +popdef(`b') +dnl @result{} +b +dnl @result{}1 +pushdef(`c', `1')pushdef(`c', `2') +dnl @result{} +stack_foreach_sep_lifo(`c', `', `', `, ') +dnl @result{}2, 1 +undivert(`stack_sep.m4')dnl +dnl @result{}divert(`-1') +dnl @result{}# stack_foreach_sep(macro, pre, post, sep) +dnl @result{}# Invoke PRE`'defn`'POST with a single argument of each definition +dnl @result{}# from the definition stack of MACRO, starting with the oldest, and +dnl @result{}# separated by SEP between definitions. +dnl @result{}define(`stack_foreach_sep', +dnl @result{}`_stack_reverse_sep(`$1', `tmp-$1')'dnl +dnl @result{}`_stack_reverse_sep(`tmp-$1', `$1', `$2`'defn(`$1')$3', `$4`'')') +dnl @result{}# stack_foreach_sep_lifo(macro, pre, post, sep) +dnl @result{}# Like stack_foreach_sep, but starting with the newest definition. +dnl @result{}define(`stack_foreach_sep_lifo', +dnl @result{}`_stack_reverse_sep(`$1', `tmp-$1', `$2`'defn(`$1')$3', `$4`'')'dnl +dnl @result{}`_stack_reverse_sep(`tmp-$1', `$1')') +dnl @result{}define(`_stack_reverse_sep', +dnl @result{}`ifdef(`$1', `pushdef(`$2', defn(`$1'))$3`'popdef(`$1')$0( +dnl @result{} `$1', `$2', `$4$3')')') +dnl @result{}divert`'dnl |