327 |
Programming in M4sugar |
Programming in M4sugar |
328 |
|
|
329 |
* Redefined M4 Macros:: M4 builtins changed in M4sugar |
* Redefined M4 Macros:: M4 builtins changed in M4sugar |
330 |
|
* Evaluation Macros:: More quotation and evaluation control |
331 |
* Forbidden Patterns:: Catching unexpanded macros |
* Forbidden Patterns:: Catching unexpanded macros |
332 |
|
|
333 |
Writing Autoconf Macros |
Writing Autoconf Macros |
6878 |
|
|
6879 |
@menu |
@menu |
6880 |
* Redefined M4 Macros:: M4 builtins changed in M4sugar |
* Redefined M4 Macros:: M4 builtins changed in M4sugar |
6881 |
|
* Evaluation Macros:: More quotation and evaluation control |
6882 |
* Forbidden Patterns:: Catching unexpanded macros |
* Forbidden Patterns:: Catching unexpanded macros |
6883 |
@end menu |
@end menu |
6884 |
|
|
6966 |
@end example |
@end example |
6967 |
@end defmac |
@end defmac |
6968 |
|
|
6969 |
|
@node Evaluation Macros |
6970 |
|
@subsection Evaluation Macros |
6971 |
|
|
6972 |
|
The following macros give some control over the order of the evaluation |
6973 |
|
by adding or removing levels of quotes. They are meant for hard core M4 |
6974 |
|
programmers. |
6975 |
|
|
6976 |
|
@defmac m4_dquote (@var{arg1}, ...) |
6977 |
|
@msindex dquote |
6978 |
|
Return the arguments as a quoted list of quoted arguments. |
6979 |
|
@end defmac |
6980 |
|
|
6981 |
|
@defmac m4_quote (@var{arg1}, ...) |
6982 |
|
@msindex quote |
6983 |
|
Return the arguments as a single entity, i.e., wrap them into a pair of |
6984 |
|
quotes. |
6985 |
|
@end defmac |
6986 |
|
|
6987 |
|
The following example aims at emphasing the difference between (i), not |
6988 |
|
using these macros, (ii), using @code{m4_quote}, and (iii), using |
6989 |
|
@code{m4_dquote}. |
6990 |
|
|
6991 |
|
@example |
6992 |
|
$ @kbd{cat example.m4} |
6993 |
|
# Over quote, so that quotes are visible. |
6994 |
|
m4_define([show], [$[]1 = [$1], $[]@@ = [$@@]]) |
6995 |
|
m4_divert(0)dnl |
6996 |
|
show(a, b) |
6997 |
|
show(m4_quote(a, b)) |
6998 |
|
show(m4_dquote(a, b)) |
6999 |
|
$ @kbd{autom4te -l m4sugar example.m4} |
7000 |
|
$1 = a, $@@ = [a],[b] |
7001 |
|
$1 = a,b, $@@ = [a,b] |
7002 |
|
$1 = [a],[b], $@@ = [[a],[b]] |
7003 |
|
@end example |
7004 |
|
|
7005 |
|
|
7006 |
|
|
7007 |
@node Forbidden Patterns |
@node Forbidden Patterns |
7008 |
@subsection Forbidden Patterns |
@subsection Forbidden Patterns |
7009 |
|
|