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
|
divert(`-1')
dnl# Creates a heredoc function for inlining long strings (or files)
dnl# This has a lot of limitations due to how M4 is handled, but a lot
dnl# of common problems have been worked out...
dnl# You must use this syntax:
dnl# HERE _DOC(...)
dnl# HERE _DOC(<<<...>>>)
dnl# TODO: Figure out Emacs REGEXP syntax and do the carriage return
dnl# correctly (to handle CRLF/LF)
define(`HD_REMOVECOMMA',`patsubst(<<<$1>>>,<<<,>>>,<<HD_COMMA>>)')
define(`HD_REPLACECOMMA',`patsubst(<<<$1>>>,<<HD_COMMA>>,<<<,>>>)')
define(`HD_ESCAPENL',`patsubst(<<<$1>>>,<<<
>>>,\\n)')
define(`HD_ESCAPEQT',`patsubst(<<<$1>>>,",\\")')
define(`HD_ESCAPESL',`patsubst(<<<$1>>>,\\,\\\\)')
define(`HD_START',`dnl
HD_REPLACECOMMA(HD_ESCAPEQT(HD_ESCAPENL(HD_ESCAPESL(HD_REMOVECOMMA(<<<$1>>>)))))<<<>>>')
define(`HERE',`changequote(<<<,>>>)')
dnl# Could this also not use the external safe_mhx to be safer?
define(`_DOC',`"HD_START(<<<$1>>>)"changequote')
dnl# Here we really need to trick M4 into not parsing the returned
dnl# output. Since it got too complicated here a separate script
dnl# was created to do it.
define(`_FILE',`"esyscmd(bash DHLIB_ROOT/m4/safe_mhx.sh "FILEDIR/$1")"changequote')
divert
|