ColdFrame: Generation of code

Code is generated using the XSLT stylesheet generate-ada.xsl. The XSLT processor used is the SAXON HE XSLT Processor from Michael Kay.

It's possible to add your own post-processing for special code generation methods.

The output is placed by the Makefile into one Ada source file, package-name.ada.

The Makefile then uses GNAT's gnatchop to split the file into the required "one file per library unit" style. Other compilers will have their own way of importing the code. Note, however, that the supplied stylesheets make use of GNAT extensions ('Unrestricted_Access).

The generated code is compilable, but operation and task bodies will raise the exception Unimplemented if called (except for operations recognised as accessors).

ColdFrame makes no attempt to allow you to modify generated bodies and preserve your changes on the next generation; instead, the idea is that you keep the generated code in one directory and your real code bodies in another directory that's earlier on the compiler's source search path. I'm not sure how the idea of placing real subprogram body files earlier in the compiler's source search path translates to compilers other than GNAT; however, on regeneration the supplied Makefile deletes all generated code bodies that have implementations (this is necessary for using the GNAT Project facility).

You can see a listing and explanation of error and warning messages that may appear.

Options

XSLT script options are passed to the script using assignments of the form option=value on the Saxon command line. The script generate-ada.xsl recognises the options

add-blank-lines
If the value is yes, blank lines are added to the generated Ada to make it easier to read, in case you have to.
The Make variable is BLANK_LINES, default yes.
checking-policy
If the value is relaxed, some errors are demoted to warnings.
The Make variable is CHECKING, default strict.
continuation-indent
Specifies the indentation increment for continuation lines; the value is a string of space characters, the default being 2 spaces.
There's no Make variable for this.
fill-column
Specifies the fill width for comments, the default being 70.
There's no Make variable for this.
generate-accessors
If the value is yes, both Set and Get accessor operations will be generated directly in the package body for all attributes.
If the value is defined (the Makefile default), operations which match the profile of accessors (Get_attribute-name with no parameters returning a value of attribute-type, or Set_attribute-name with no return value and a single parameter of attribute-type) will have proper bodies generated for them (they will still be generated as separate subprograms, though, unless they're stereotyped or tagged accessor).
Otherwise, no special notice will be taken of accessors or attributes.
The Make variable is GENERATE_ACCESSORS, default defined.
generate-event-logging
Controls whether code to log Event processing is generated.
The Make variable is GENERATE_EVENT_LOGGING, default no.
generate-stubs
Specifies whether test stub bodies are to be generated.
The Make variable is GENERATE_STUBS, default no.
max-bounded-container
If a class is known never to have more than this number of instances, a bounded container will be used. The default is 49.
There's no Make variable for this.
max-hash-buckets
The number of hash buckets used for map containers will be the same as the maximum number of instances so long as it's less than this value. The default is 49.
There's no Make variable for this.
profile
The Ada execution profile; if not standard, code generated will be compliant with a restricted profile (such as Ravenscar).
The Make variable is PROFILE, default standard.
standard-indent
Specifies the standard indentation increment; the value is a string of space characters, the default being 3 spaces.
There's no Make variable for this.
unit-test-support
Specifies whether a Unit_Test child package is required for each class.
The Make variable is UNIT_TEST_SUPPORT, default no.
verbose
Specifies whether ColdFrame should report what it's doing.
The Make variable is VERBOSE, default no.