summaryrefslogtreecommitdiff
path: root/checks/089.stacks
blob: f90ab29deab76ca2527d81926baf49ac2878e726 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
dnl @ ../doc/m4.texi:3533: 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.
undivert(`stack.m4')dnl
dnl @result{}divert(`-1')
dnl @result{}# stack_foreach(macro, action)
dnl @result{}# Invoke ACTION with a single argument of each definition
dnl @result{}# from the definition stack of MACRO, starting with the oldest.
dnl @result{}define(`stack_foreach',
dnl @result{}`_stack_reverse(`$1', `tmp-$1')'dnl
dnl @result{}`_stack_reverse(`tmp-$1', `$1', `$2(defn(`$1'))')')
dnl @result{}# stack_foreach_lifo(macro, action)
dnl @result{}# Invoke ACTION with a single argument of each definition
dnl @result{}# from the definition stack of MACRO, starting with the newest.
dnl @result{}define(`stack_foreach_lifo',
dnl @result{}`_stack_reverse(`$1', `tmp-$1', `$2(defn(`$1'))')'dnl
dnl @result{}`_stack_reverse(`tmp-$1', `$1')')
dnl @result{}define(`_stack_reverse',
dnl @result{}`ifdef(`$1', `pushdef(`$2', defn(`$1'))$3`'popdef(`$1')$0($@)')')
dnl @result{}divert`'dnl