Reference Developer Tutorial 1 Introduction 2 Macros 3 Typesetting 4 Example 5 Hints 6 Examples 7 Webmaking SEARCH

2.6 Library Macros

FunnelWeb provides a library macro feature that allows you to redefine macros. Normally, FunnelWeb will generate an error if you attempt to define a macro of a particular name more than once. However, if you attach a different number of `@L` markers (up to five) to each definition, FunnelWeb accepts the multiple definitions, and at tangle time uses the definition with the least number of `@L`s. For example:

    @$@<ugly duckling@>@L@L@{egg@}
    @$@<ugly duckling@>@{swan@}
    @$@<ugly duckling@>@L@{signet@}

In this example, the ugly duckling macro will expand to `swan` because the swan definition has the least number of `@L` markers (i.e. the lowest library level).

No two definitions may have the same name and level, but definitions having the same name, but differing levels, are independent of each other and can have different call number constraints. They can even be defined additively, with their multipart definitions interlaced. For example:

    @$@<ugly duckling@>@L@L+=@{eg@}
    @$@<ugly duckling@>@L+=@{sig@}
    @$@<ugly duckling@>@L@L+=@{g@}
    @$@<ugly duckling@>@L+=@{net@}

Here, two macros having the same name (`ugly duckling`) are defined at library levels one and two. Each of these macros is defined in two additive parts. The first macro is at level two and has the value `egg`. The second macro is at level one and has the value `signet`. If this macro name were referenced by another macro, it would be expanded to `signet`, as this is the value of the definition with the lowest library level.

Uses Of Library Macros

When using FunnelWeb as a macro preprocessor (e.g. for the generation of HTML webs), it's convenient to be able to define include files that contain large numbers of commonly used macro definitions. However, sometimes, some macros must be redefined. By tagging such macros in the include file using `@L`, such redefinition is made possible.

Webmaster Copyright © Ross N. Williams 1992,1999. All rights reserved.