-m4_define([SIMPLE_DECL], [SIMPLE_DECLS([[$1]], [[$2]])])
-
-SIMPLE_DECLS([[int **], [int **x]],
- [[type pointer to pointer to int],
- [declare x as pointer to pointer to int]])
-SIMPLE_DECLS([[int (*x)], [int (*)]],
- [[declare x as pointer to int],
- [type pointer to int]])
-SIMPLE_DECL([int (x*)], [type function (pointer to x) returning int])
+
+dnl SIMPLE_DECLS(arg, [arg ...])
+m4_define([SIMPLE_DECLS],
+[SIMPLE_DECLS_EXPLAIN($@)
+SIMPLE_DECLS_DECLARE($@)])
+
+SIMPLE_DECLS(
+ [[int **], [type pointer to pointer to int]],
+ [[int **x], [declare x as pointer to pointer to int]])
+
+SIMPLE_DECLS(
+ [[int (*x)], [declare x as pointer to int], [int *x]],
+ [[int (*)], [type pointer to int], [int *]])
+
+SIMPLE_DECLS(
+ [[int (x*)], [type function (pointer to x) returning int], [int (x *)]])
+
+SIMPLE_DECLS(
+ [[int (x)()], [declare x as function returning int], [int x()]])
+
+dnl Check that function reduction does not occur in english parses
+SIMPLE_DECLS(
+ [[int (x)], [type function (x) returning int], [], [declare x as int]])
+
+SIMPLE_DECLS(
+ [[int x@<:@@:>@], [declare x as array of int]],
+ [[int @<:@@:>@], [type array of int]])
+
+SIMPLE_DECLS(
+ [[int x@<:@n@:>@], [declare x as variable-length array n of int]],
+ [[int x@<:@*@:>@], [declare x as variable-length array of int]],
+ [[int @<:@n@:>@], [type variable-length array n of int]],
+ [[int @<:@*@:>@], [type variable-length array of int]])
+
+SIMPLE_DECLS_EXPLAIN(
+ [[int ((int))], [type function (int) returning int], [int (int)]],
+ [[int (x(int))], [declare x as function (int) returning int], [int x(int)]],
+ [[int (())], [type function returning int], [int ()]])
+
+SIMPLE_DECLS_EXPLAIN(
+ [[int (x())], [declare x as function returning int], [int x()]],
+ [[int ((x)())], [declare x as function returning int], [int x()]])
+
+dnl Test that english-only keywords are not rejected as idenfitiers in C mode.
+SIMPLE_DECLS_EXPLAIN(
+ [[of array@<:@@:>@], [declare array as array of of]],
+ [[returning as(function)],
+ [declare as as function (function) returning returning]],
+ [[pointer *declare], [declare declare as pointer to pointer]],
+ [[type to], [declare to as type]])
+
+dnl Test the explain command with multiple declarators, which produces
+dnl multiple lines of English output.
+SIMPLE_DECLS_EXPLAIN(
+ [[int x, y], [m4_n([declare x as int])declare y as int]])
+
+dnl Test the simplify command with multiple declarators. This is the only
+dnl command in cdecl99 which will print a single C declaration with more than
+dnl one full declarator.
+SIMPLE_DECLS_SIMPLIFY(
+ [[int x, y], [int x, y]],
+ [[int (x), ((y))], [int x, y]])