M4 (computer Language) - Example

Example

The following fragment gives a simple example that could form part of a library for generating HTML code. It defines a commented macro to number sections automatically:

divert(-1) M4 has multiple output queues that can be manipulated with the `divert' macro. Valid queues range from 0 to 10, inclusive, with the default queue being 0. Calling the `divert' macro with an invalid queue causes text to be discarded until another call. Note that even while output is being discarded, quotes around `divert' and other macros are needed to prevent expansion. # Macros aren't expanded within comments, meaning that keywords such # as divert and other built-ins may be used without consequence. # HTML utility macro: define(`H2_COUNT', 0) # The H2_COUNT macro is redefined every time the H2 macro is used: define(`H2', `define(`H2_COUNT', incr(H2_COUNT))

Read more about this topic:  M4 (computer Language)

Famous quotes containing the word example:

    Our intellect is not the most subtle, the most powerful, the most appropriate, instrument for revealing the truth. It is life that, little by little, example by example, permits us to see that what is most important to our heart, or to our mind, is learned not by reasoning but through other agencies. Then it is that the intellect, observing their superiority, abdicates its control to them upon reasoned grounds and agrees to become their collaborator and lackey.
    Marcel Proust (1871–1922)