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

Re: Question about pass 4 (m4)

On Sat, Jan 16, 1999 at 12:37:31PM +0100, Alexander Graefe wrote:
> But I have one big question: What is the usefulness of pass 4 (m4) ?
> Maybe it's because I have never used m4 for anything before, but maybe
> it's exactly the thing I am looking for, I just didn't know it :)
> So what I am asking for is basically an easy example, of what the
> m4-pass does, and what it can be used for.

m4 is best described as a macro processor.

one of the most-used features of m4 is the ability to make macros on the
fly, similar to WML's own features.

m4 works something like this:

first, you define the macro to create:

define(`foo', `Hello World')

This can appear anywhere in the document; it doesn't even have to be on
the beginning of a line!

once you have the macro defined, you can then use it anywhere as a
replacement for the macro's contents.

As I said before, foo.

And it will print out "As I said before, Hello World."

As you can see, it would not be a good idea to use common words as macros,
because then they could be replace when the word itself would have been
better off.

For further detailed descriptions of the uses of this wonderful macro
preprocessor, check out the m4 info page... it's very well-written.

(NOTE: There are also ways to produce arguments which can be handled
       by the macro)

True hacking requires a piece of wood and an axe.

	-Reteo Varala (reteo@geocities.com)
Website META Language (WML)                www.engelschall.com/sw/wml/
Official Support Mailing List                   sw-wml@engelschall.com
Automated List Manager                       majordomo@engelschall.com