GNU Info

Info Node: (autoconf.info)Quadrigraphs

(autoconf.info)Quadrigraphs


Next: Quotation Rule Of Thumb Prev: Changequote is Evil Up: M4 Quotation
Enter node , (file) or (file)node

Quadrigraphs
------------

   When writing an autoconf macro you may occasionally need to generate
special characters that are difficult to express with the standard
autoconf quoting rules.  For example, you may need to output the regular
expression `[^[]', which matches any character other than `['.  This
expression contains unbalanced brackets so it cannot be put easily into
an M4 macro.

   You can work around this problem by using one of the following
"quadrigraphs":

`@<:@'
     `['

`@:>@'
     `]'

`@S|@'
     `$'

`@%:@'
     `#'

`@&t@'
     Expands to nothing.

   Quadrigraphs are replaced at a late stage of the translation process,
after `m4' is run, so they do not get in the way of M4 quoting.  For
example, the string `^@<:@', independently of its quotation, will
appear as `^[' in the output.

   The empty quadrigraph can be used:

   - to mark explicitly trailing spaces

     Trailing spaces are smashed by `autom4te'.  This is a feature.

   - to produce other quadrigraphs

     For instance `@<@&t@:@' produces `@<:@'.

   - to escape _occurrences_ of forbidden patterns

     For instance you might want to mention `AC_FOO' is a comment, while
     still being sure that `autom4te' will still catch unexpanded
     `AC_*'.  Then write `AC@&t@_FOO'.

   The name `@&t@' was suggested by Paul Eggert:

     I should give some credit to the `@&t@' pun.  The `&' is my own
     invention, but the `t' came from the source code of the ALGOL68C
     compiler, written by Steve Bourne (of Bourne shell fame), and
     which used `mt' to denote the empty string.  In C, it would have
     looked like something like:

          char const mt[] = "";

     but of course the source code was written in Algol 68.

     I don't know where he got `mt' from: it could have been his own
     invention, and I suppose it could have been a common pun around the
     Cambridge University computer lab at the time.


automatically generated by info2www version 1.2.2.9