1
0
Files
2016-11-30 09:03:17 +08:00

27 lines
1.2 KiB
Plaintext

dnl @ ../doc/m4.texinfo:3455: 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