www.delorie.com/gnu/docs/m4/m4_19.html   search  
 
Buy GNU books!


GNU macro processor

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

4.1 Defining a macro

The normal way to define or redefine macros is to use the builtin define:

 
define(name [, expansion])

which defines name to expand to expansion. If expansion is not given, it is taken to be empty.

The expansion of define is void.

The following example defines the macro foo to expand to the text `Hello World.'.

 
define(`foo', `Hello world.')
=>
foo
=>Hello world.

The empty line in the output is there because the newline is not a part of the macro definition, and it is consequently copied to the output. This can be avoided by use of the macro dnl. See section 7.1 Deleting whitespace in input, for details.

The macro define is recognized only with parameters.


  webmaster     delorie software   privacy  
  Copyright 2003   by The Free Software Foundation     Updated Jun 2003