% output=pdftex engine=pdftex language=uk
%
% copyright=pragma-ade readme=readme.pdf licence=cc-by-nc-sa

\startcomponent mfun-011

\environment mfun-000

\chapter {\METAFUN\ macros}

\startintro

\CONTEXT\ comes with a series of \METAPOST\ modules. In this
chapter we will summarize the most important \TEX\ and
\METAPOST\ macros. More information can be found in the
documentation of the modules.

\stopintro

There are several ways to use the power of \METAFUN, either
or not using \CONTEXT.

\startitemize[n]

\item You can create an independent \type {mp} file and
process it with the \METAPOST\ program or \MPTOPDF.
Depending on what features you use, the succes of a run
depends on the proper set up of the auxiliary programs that
take care of running \TEX\ for \type {btex}.

\item You can embed the graphic in a \type {\startMPpage}
construct and process it with \TEXEXEC. In that case you have
the full \METAFUN\ functionality available. Before processing
the file, \TEXEXEC\ will do a couple of checks on the file. It
will also make sure that the auxiliary files (\type {mpt} for
\type {textext}'s and \type {mpo} for outline fonts) are
taken care of too.

\item You can integrate the graphic in the document flow,
using buffers, \METAPOST\ code sections, or (reusable) graphic
containers. In that case the graphics are processed runtime
or between runs. As with the second method, \TEXEXEC\ will
handle the auxiliary files and programs for you.

\stopitemize

Unless you want to write low level \CONTEXT\ code yourself,
there is no real reason to look into the modules that deal
with \METAPOST\ support.

\starttabulate[|lT|p|]
\NC supp-mps.tex \NC low level inclusion macros and housekeeping \NC\NR
\NC supp-mpe.tex \NC experimental extensions (like specials)     \NC\NR
\NC supp-pdf.tex \NC \METAPOST\ to \PDF\ conversion              \NC\NR
\NC meta-ini.tex \NC high level inclusion macros and interfacing \NC\NR
\NC meta-***.tex \NC subsystems and handy macros                 \NC\NR
\stoptabulate

The last category will certainly grow. Some of these modules
are preloaded, others can be loaded using the command \type
{\useMPlibrary}, like

\starttyping
\useMPlibrary[clp,txt]
\stoptyping

for loading the predefined clipping paths and text tricks.

The \METAPOST\ code is organized in files named \type
{mp-****.mp}. The core file is \type {mp-tool.mp} and this
file can comfortably be used in stand||alone graphics. The
file \type {metafun.mp} is used to load the collection of
modules into a format. The collection of \METAPOST\ code
files will grow in due time, but as long as you use the
\METAFUN\ format, you don't have to keep track of the
organization of files. Most files relate to subsystems and
are loaded automatically, like the files that implement page
layout support and flow charts.

As soon as the code in \METAFUN\ is stable and is implemented
in a decent way, it will be documented in more detail.
Although this document is the main source of information,
occasionally the source code of \METAFUN, and in many cases
the source code of \CONTEXT\ may contain additional
information and examples. You can generated a typeset version
of sources with:

\starttyping
texexec --modu --pdf somefile.tex (or somefile.mp)
\stoptyping

A simple listing can be generated with:

\starttyping
texexec --list --pdf somefile.tex (or somefile.mp)
\stoptyping

\stopcomponent
