Imported Upstream version 1.4.16
[platform/upstream/m4.git] / checks / 089.stacks
1 dnl @ ../doc/m4.texinfo:3504: Origin of test
2 dnl @ expected status: 0
3 dnl @ extra options: 
4 dnl @ Copyright (C) 2006, 2007, 2008, 2009 Free Software
5 dnl @ Foundation, Inc.
6 dnl @ This file is free software; the Free Software Foundation
7 dnl @ gives unlimited permission to copy and/or distribute it
8 dnl @ with or without modifications, as long as this notice
9 dnl @ is preserved.
10 undivert(`stack.m4')dnl
11 dnl @result{}divert(`-1')
12 dnl @result{}# stack_foreach(macro, action)
13 dnl @result{}# Invoke ACTION with a single argument of each definition
14 dnl @result{}# from the definition stack of MACRO, starting with the oldest.
15 dnl @result{}define(`stack_foreach',
16 dnl @result{}`_stack_reverse(`$1', `tmp-$1')'dnl
17 dnl @result{}`_stack_reverse(`tmp-$1', `$1', `$2(defn(`$1'))')')
18 dnl @result{}# stack_foreach_lifo(macro, action)
19 dnl @result{}# Invoke ACTION with a single argument of each definition
20 dnl @result{}# from the definition stack of MACRO, starting with the newest.
21 dnl @result{}define(`stack_foreach_lifo',
22 dnl @result{}`_stack_reverse(`$1', `tmp-$1', `$2(defn(`$1'))')'dnl
23 dnl @result{}`_stack_reverse(`tmp-$1', `$1')')
24 dnl @result{}define(`_stack_reverse',
25 dnl @result{}`ifdef(`$1', `pushdef(`$2', defn(`$1'))$3`'popdef(`$1')$0($@)')')
26 dnl @result{}divert`'dnl