[Top][All Lists]

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

Re: m4-discuss Digest, Vol 72, Issue 1

From: John Allsup
Subject: Re: m4-discuss Digest, Vol 72, Issue 1
Date: Mon, 18 Jul 2011 12:10:35 +0100
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv: Gecko/20110617 Thunderbird/3.1.11

I've had a little think about this. The simplest problem I can set you m4 people is the task of writing
a simple macro driven input that does the following:

Given a source file in1.m4 which contains the following:
    A word can expand to many things.
and the file def.m4 which contains
    define(word,term)define(many,a great `many')
the challenge is to generate the output
The phrase 'A word can expand to many things' may be expanded to the following.
        A term can expand to a great many things.
using the simplest m4 input possible and by referring to the contents of the file via inclusion so that
if the contents of the input file change, the output changes accordingly.

Have a think.


On 18/07/11 03:57, John Calcote wrote:
Hi John,

I see exactly what you want, but I'm not sure what you're asking for is
reasonable. Why would you want to run a file though a macro processor and
not have it process any macros? Given your original input files, "a" and
"b", consider this sequence of commands:

cat a | m4>  out.txt
cat b>>  out.txt

This would see to accomplish exactly what you want, wouldn't it?

John Calcote

-----Original Message-----
From: address@hidden
[mailto:address@hidden On Behalf Of
Sent: Sunday, July 17, 2011 10:00 AM
To: address@hidden
Subject: m4-discuss Digest, Vol 72, Issue 1

Send m4-discuss mailing list submissions to

To subscribe or unsubscribe via the World Wide Web, visit
or, via email, send a message with subject or body 'help' to

You can reach the person managing the list at

When replying, please edit your Subject line so it is more specific than
"Re: Contents of m4-discuss digest..."

Today's Topics:

    1. Simple method of including a file that bypasses macro
       expansion (John Allsup (M4))


Message: 1
Date: Sun, 17 Jul 2011 08:15:04 +0100 (BST)
From: "John Allsup (M4)"<address@hidden>
To: address@hidden
Subject: Simple method of including a file that bypasses macro
Content-Type: text/plain; charset="utf-8"

I am relatively new to m4, but can't seem to find an equivalent to include
that bypasses macro expansion.
Suppose file 'a' contains
? hello world
and file 'b' contains
? goodbye world
and in my m4 I have defined
? define(world,and).
I a macro which I will call 'oinclude' such that ? include(a) oinclude(b)
expands to ? hello and goodbye world.

Is there a simple method?
-------------- next part --------------
An HTML attachment was scrubbed...

End of m4-discuss Digest, Vol 72, Issue 1

reply via email to

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