[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

defn() with multiple arguments

From: Schwarz, Konrad
Subject: defn() with multiple arguments
Date: Mon, 6 Aug 2007 09:54:40 +0200


I am not sure if a future version of GNU m4 intends to become compliant with POSIX in the matter of defn() with multiple arguments.

However, I think the following example motivates this feature, should you in fact have need of motivation.

In my application, I build up program text in macros; more exactly, I build up nested `foreach()' loops when expanding macros.  Each input line consists of a single macro invocation, each such line adds a level of nesting to the resulting program text, which is expanded when a section of such lines has been read.  The program text is held in certain macros, such as LOOP_BEGIN, LOOP_END, LOOP_BODY, etc., which are concatenated at the end of a section.  (As an aside, these macros typically have an unbalanced set of quotes and require local changes to the quote characters to be processed correctly.)

Anyhow, my code for concatenating/rereading/executing the resultant program text currently looks like this:

define(`ALL', changequote([,])defn(LOOP_BEGIN)[]defn(
The local change of quotes is required because the different loop parts have unbalanced quotes.  My hope would be that with a multiple-argument defn(), this could be simplified to:
define(`ALL', defn(`LOOP_BEGIN', `LOOP_BODY', `LOOP_END'))ALL
In other words, that defn() be implemented to concatenate its arguments first, then to quote the resulting string as a whole.

Konrad Schwarz

Attachment: Konrad Schwarz.vcf
Description: Konrad Schwarz.vcf

reply via email to

[Prev in Thread] Current Thread [Next in Thread]