Contents | Parent Topic | Previous Topic | Next Topic
Home | Catalog

# 2.4. Macros

## 2.4.1. Introduction

A macro is a command which can be embedded within SDF. Macros begin with an exclamation mark (!) as the first non-whitespace character on a line. Some examples are:

      !use "delphi"
      !define DOC_AUTHOR "Joe Bloggs"
      !build_title

## 2.4.2. Commonly used macros

Some commonly used macros are given below.

Macro | Description
init variables | initialise variables
define variable [expression] | set a variable's value
build_title | build a title page
block filter | begin a block of text
endblock | end a block of text
include file[; filter] | include another file
import file[; parameters] | import a figure

A complete list of the supported macros and their parameters is given in the SDF Reference manual.

## 2.4.3. Creating new macros

The easiest way to create a new macro is to use the macro and endmacro macros. For example:

    !macro MY_MACRO
    This text will appear whenever the author calls !MY_MACRO.
    !endmacro

Macros can also be implemented by a Perl subroutine which generates the SDF text to be inserted when the macro is called. See the SDF Guru Guide for further details.