X-Git-Url: http://git.hcoop.net/bpt/mlt.git/blobdiff_plain/a80c83d408a62bce9652f2006f3a5dde4984b91f..b26ce3d96429d8721e85500d48d7dab2f97688e5:/doc/manual.tex?ds=sidebyside diff --git a/doc/manual.tex b/doc/manual.tex index beb35d5..ada1809 100644 --- a/doc/manual.tex +++ b/doc/manual.tex @@ -48,6 +48,12 @@ Files consist of a sequence of the following kinds of lines in any order: \item {\tt cm {\it file}}: {\it file} is the path to a file that the SML/NJ Compilation Manager understands (i.e., {\tt .cm}, {\tt .sml}, {\tt .sig}, {\tt .grm}, {\tt .lex}). This file is to be made available to templates in the project. \item {\tt print {\it type} = {\it code}}: This declares that the given {\it code} is an SML expression that evaluates to an appropriate function for printing values of the SML {\it type}. The {\it code} should usually be the name of a function defined in a library or project SML source file. + + \item {\tt before {\it template}}: Run {\it template} before every normally-requested template, including its output at the beginning of the final output. This can be used to set up project-wide global state. Performing initialization inside project SML files will not generally be good enough. This is because all of the structure definitions these contain are evaluated at ``compile time,'' causing their code not found inside function definitions to be run only once. + + \item {\tt after {\it template}}: Run {\it template} after every successfully executing template, including its output at the end. + + \item {\tt exn {\it template}}: Run {\it template} when an exception goes uncaught during normal template execution. The function {\tt Web.getExn : unit -> exn} can be used to retrieve the causing exception from within {\it template}. The {\tt before} and {\tt after} templates are not run in the {\tt exn} template when it is executed because of an uncaught exception. \end{itemize} \section{The template language}