“MiST Engine” stands for “Minimal String Template Engine”. It is a lightweight system that allows to generate data based on special templates and on the values of parameters these templates refer to.
In the most simple case, these templates are little more than just “documents with holes” where the engine sticks appropriate data. Each “hole”, or placeholder, has a name and can be assigned one or more values (or even none at all). A more complex template can refer to other templates (“subtemplates”) - this is as if the subtemplates were substituted to the corresponding location in the template.
MiST Engine makes no assumptions about what the templates and the data to stick in are intended for. The templates define how the resulting document (a string, actually) will look like. The same data passed to the different sets of the templates results in different output documents. That is, the templates define the view of the data.
For example, suppose we have statistical data about how many people visited a particular web site each day of a given period of time. A set of templates may allow us to arrange this information, say, in a table on a HTML page. If we apply another set of templates to the same data, we could prepare a simple report in a plain text format, and so on.
A description of various aspects of template processing can be found here: http://en.wikipedia.org/wiki/Template_processor.
There is a number of string template engines of various kinds existing today. Some of these may be much more powerful than MiST Engine. Still, MiST Engine has its niche.
Key features of MiST Engine:
MiST Engine enforces model-view separation. This means, no operation on data is allowed in the templates except for sticking that data into appropriate place and, may be, checking whether a particular parameter is defined (has a non-empty value). That is, no calculations, no database requests to pull in the data from somewhere, etc. The templates are therefore a purely presentational part. All other operations on the data (model) should be performed by the provider of that data.
This may seem to complicate things but, actually, the benefits of model-view separation are usually greater than the difficulties it creates. If a data model and the views used for it are not entangled, we can develop, debug, update and otherwise maintain them separately from one another, which can be quite convenient. Changes in the data model will not require changes in the views (templates) and vice versa as long as “the interface” between them (names and the meaning of the parameters to stick into the templates) is the same. This is also safer and less error-prone.
MiST Engine is written in plain C. It uses only C runtime library, so no other external library is needed to build and use it.
MiST Engine is minimal in a sense that the templates it operates on may contain only few types of constructs (namely, string chunks, references, joining and conditionals). This allows the engine to be applicable in real-world applications while remaining very lightweight.
In addition to a standalone command line tool, MiST Engine provides a rather simple C API implemented in the dynamic library (shared object on Linux, DLL on Microsoft Windows).
MiST Engine is available both on Linux and on Microsoft Windows systems.
MiST Engine dynamic library can be used from the applications being built with GCC (version 4.0 or newer is preferable) or with the build tools provided by Microsoft Visual Studio (currently tested with Visual C++ 2003, 2005 and 2008, may work with other versions as well). Note that the library itself should be built with GCC or a compatible compiler.
The core parts of MiST Engine are used in “Template–to–Code” (“T2C”) system that facilitates development of parameterized tests and uses template-based techniques to generate the source code of the tests as well as other necessary files.
The latest stable version of MiST Engine as well as the development versions can be found at “Template–to–Code” project site at SourceForge.net