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 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149
|
divert(-1) dnl -*- m4 -*-
# This file is part of Mailfromd.
# Copyright (C) 2007-2025 Sergey Poznyakoff
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3, or (at your option)
# any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
changecom(/*,*/)
/* ------------------------------
* Simulate --prefix-builtins.
* Borrowed from Autoconf
* ------------------------------- */
define(`m4_define', defn(`define'))
define(`m4_defn', defn(`defn'))
define(`m4_undefine', defn(`undefine'))
m4_undefine(`define')
m4_undefine(`defn')
m4_undefine(`undefine')
/* m4_copy(SRC, DST)
* -----------------
* Define DST as the definition of SRC.
* What's the difference between:
* 1. m4_copy(`from', `to')
* 2. m4_define(`to', `from($@)')
* Well, obviously 1 is more expensive in space. Maybe 2 is more expensive
* in time, but because of the space cost of 1, it's not that obvious.
* Nevertheless, one huge difference is the handling of `$0'. If `from'
* uses `$0', then with 1, `to''s `$0' is `to', while it is `from' in 2.
* The user will certainly prefer to see `to'.
*/
m4_define(`m4_copy',
`m4_define(`$2', m4_defn(`$1'))')
/* m4_rename(SRC, DST)
* -------------------
* Rename the macro SRC as DST.
*/
m4_define(`m4_rename',
`m4_copy(`$1', `$2')m4_undefine(`$1')')
/* m4_rename_m4(MACRO-NAME)
* ------------------------
* Rename MACRO-NAME as m4_MACRO-NAME.
*/
m4_define(`m4_rename_m4',
`m4_rename(`$1', `m4_$1')')
/* Some m4 internals have names colliding with tokens we might use.
* Rename them a` la `m4 --prefix-builtins'.
*/
m4_rename_m4(`builtin')
m4_rename_m4(`changecom')
m4_rename_m4(`changequote')
m4_rename_m4(`debugfile')
m4_rename_m4(`debugmode')
m4_rename_m4(`decr')
m4_rename_m4(`divert')
m4_rename_m4(`divnum')
m4_rename_m4(`dumpdef')
m4_rename_m4(`errprint')
m4_rename_m4(`esyscmd')
m4_rename_m4(`eval')
m4_rename_m4(`format')
m4_rename_m4(`ifdef')
m4_rename_m4(`ifelse')
m4_rename_m4(`include')
m4_rename_m4(`incr')
m4_rename_m4(`index')
m4_rename_m4(`indir')
m4_rename_m4(`len')
m4_rename(`m4exit', `m4_exit')
m4_rename(`m4wrap', `m4_wrap')
m4_rename_m4(`maketemp')
m4_rename_m4(`patsubst')
m4_rename_m4(`popdef')
m4_rename_m4(`pushdef')
m4_rename_m4(`regexp')
m4_rename_m4(`shift')
m4_rename_m4(`sinclude')
m4_rename_m4(`substr')
m4_rename_m4(`symbols')
m4_rename_m4(`syscmd')
m4_rename_m4(`sysval')
m4_rename_m4(`traceoff')
m4_rename_m4(`traceon')
m4_rename_m4(`translit')
m4_rename_m4(`undivert')
m4_rename_m4(`dnl')
m4_rename_m4(`__line__')
m4_rename_m4(`__file__')
/* defined(X) -- Return true if the optional argument X is passed to
the function */
m4_define(`defined',`m4_ifelse($#,1,``$'#>@$1',``$0'')')
/* printf(FMT, ...) */
m4_define(`printf',`m4_ifelse($#,0,``$0'',`echo sprintf($*)')')
m4_define(`_', `m4_ifelse($#,1,`gettext($1)',``_'')')
m4_define(`N_', `m4_ifelse($#,1,`$1',``N_'')')
m4_dnl string_list_iterate(LIST, DELIM, VAR, CODE)
m4_dnl
m4_dnl This is a convenience macro to compensate for the lack of
m4_dnl arrays in MFL.
m4_dnl
m4_dnl LIST is a string conceptually composed of elements delimited with
m4_dnl DELIM. The macro extracts each element, assigns it to the string
m4_dnl variable VAR and executes MFL code CODE.
m4_dnl
m4_define(`string_list_iterate',`
if $1 != ""
m4_pushdef(`ITR',`__$1_itr')
m4_pushdef(`POS',`__$1_pos')
loop for string ITR $1 . $2
number POS index(ITR, $2),
while POS != -1,
set ITR substr(ITR, POS + 1)
set POS index(ITR, $2)
do
set $3 substr(ITR, 0, POS)
$4
done
m4_popdef(`POS')
m4_popdef(`ITR')
fi')
m4_ifdef(`MF_AUTOHEADER',`
m4_divert(0)m4_dnl
/* -*- buffer-read-only: t -*- vi: set ro:
THIS FILE IS GENERATED AUTOMATICALLY. PLEASE DO NOT EDIT.
*/
m4_divert(-1)')
m4_divert(0)m4_dnl
|