autoconf: Quadrigraphs
1
1 8.1.6 Quadrigraphs
1 ------------------
1
1 When writing an Autoconf macro you may occasionally need to generate
1 special characters that are difficult to express with the standard
1 Autoconf quoting rules. For example, you may need to output the regular
1 expression `[^[]', which matches any character other than `['. This
1 expression contains unbalanced brackets so it cannot be put easily into
1 an M4 macro.
1
1 Additionally, there are a few m4sugar macros (such as `m4_split' and
1 `m4_expand') which internally use special markers in addition to the
1 regular quoting characters. If the arguments to these macros contain
1 the literal strings `-=<{(' or `)}>=-', the macros might behave
1 incorrectly.
1
1 You can work around these problems by using one of the following
1 "quadrigraphs":
1
1 `@<:@'
1 `['
1
1 `@:>@'
1 `]'
1
1 `@S|@'
1 `$'
1
1 `@%:@'
1 `#'
1
1 `@{:@'
1 `('
1
1 `@:}@'
1 `)'
1
1 `@&t@'
1 Expands to nothing.
1
1 Quadrigraphs are replaced at a late stage of the translation process,
1 after `m4' is run, so they do not get in the way of M4 quoting. For
1 example, the string `^@<:@', independently of its quotation, appears as
1 `^[' in the output.
1
1 The empty quadrigraph can be used:
1
1 - to mark trailing spaces explicitly
1
1 Trailing spaces are smashed by `autom4te'. This is a feature.
1
1 - to produce quadrigraphs and other strings reserved by m4sugar
1
1 For instance `@<@&t@:@' produces `@<:@'. For a more contrived
1 example:
1
1 m4_define([a], [A])m4_define([b], [B])m4_define([c], [C])dnl
1 m4_split([a )}>=- b -=<{( c])
1 =>[a], [], [B], [], [c]
1 m4_split([a )}@&t@>=- b -=<@&t@{( c])
1 =>[a], [)}>=-], [b], [-=<{(], [c]
1
1 - to escape _occurrences_ of forbidden patterns
1
1 For instance you might want to mention `AC_FOO' in a comment, while
1 still being sure that `autom4te' still catches unexpanded `AC_*'.
1 Then write `AC@&t@_FOO'.
1
1 The name `@&t@' was suggested by Paul Eggert:
1
1 I should give some credit to the `@&t@' pun. The `&' is my own
1 invention, but the `t' came from the source code of the ALGOL68C
1 compiler, written by Steve Bourne (of Bourne shell fame), and
1 which used `mt' to denote the empty string. In C, it would have
1 looked like something like:
1
1 char const mt[] = "";
1
1 but of course the source code was written in Algol 68.
1
1 I don't know where he got `mt' from: it could have been his own
1 invention, and I suppose it could have been a common pun around the
1 Cambridge University computer lab at the time.
1