NBash

Форк
0
38 строк · 1.1 Кб
1
divert(-1)
2

3
m4 has multiple output queues that can be manipulated with the
4
`divert' macro. Valid queues range from 0 to 10, inclusive, with
5
the default queue being 0. As an extension, GNU m4 supports more
6
diversions, limited only by integer type size.
7

8
Calling the `divert' macro with an invalid queue causes text to be
9
discarded until another call.  Note that even while output is being
10
discarded, quotes around `divert' and other macros are needed to
11
prevent expansion.
12

13
# Macros aren't expanded within comments, meaning that keywords such
14
# as divert and other built-ins may be used without consequence.
15

16
# HTML utility macro:
17

18
define(`H2_COUNT', 0)
19

20
# The H2_COUNT macro is redefined every time the H2 macro is used:
21

22
define(`H2',
23
	`define(`H2_COUNT', incr(H2_COUNT))<h2>H2_COUNT. $1</h2>')
24

25
divert(1)dnl
26
dnl
27
dnl The dnl macro causes m4 to discard the rest of the line, thus
28
dnl preventing unwanted blank lines from appearing in the output.
29
dnl
30
H2(First Section)
31
H2(Second Section)
32
H2(Conclusion)
33
dnl
34
divert(0)dnl
35
dnl
36
<HTML>
37
undivert(1)dnl One of the queues is being pushed to output.
38
</HTML>

Использование cookies

Мы используем файлы cookie в соответствии с Политикой конфиденциальности и Политикой использования cookies.

Нажимая кнопку «Принимаю», Вы даете АО «СберТех» согласие на обработку Ваших персональных данных в целях совершенствования нашего веб-сайта и Сервиса GitVerse, а также повышения удобства их использования.

Запретить использование cookies Вы можете самостоятельно в настройках Вашего браузера.