SPL Reference
This section gives an overview of SPL (Spy Programming Language), the code generator's template language.
It is assumed that you have prior programming experience, and are familiar with operators, functions, variables and classes, as well as the basics of object-oriented programming - which is used heavily in SPL.
The templates used by MapForce are supplied in the ...\MapForce\spl folder. You can use these files as an aid to help you in developing your own templates.
How code generator works
Inputs to the code generator are the template files (.spl) and the object model provided by MapForce. The template files contain SPL instructions for creating files, reading information from the object model and performing calculations, interspersed with literal code fragments in the target programming language.
The template file is interpreted by the code generator and outputs .cpp, .java, .cs source code files, project files, or any other type of file depending on the template. The source code can then be compiled into an executable file that accesses XML data described by the schema file.
SPL files have access to a wide variety of information that is collated from the source schemas. Note that an SPL file is not tied to a specific schema, but allows access to all schemas. Make sure you write your SPL files generically and avoid structures which apply to specific schemas.
Example: Creating a new file in SPL
This is a very basic SPL file. It creates a file named test.cpp, and places the include statement within it. The close command completes the template.
[create "test.cpp"] #include "stdafx.h" [close] |