Advanced Topic in Ballista® Templates:
Name lines with whitespace

When creating Ballista® Template files the first line in the file is "name" line. The name line syntax is:

name C_type B_type
The Ballista compiler cannot handle embedded whitespaces within either the C_type or B_type. Normally this restriction does not pose a problem although one must remember to write void* instead of void *. Occasionally there are cases when removing whitespace is more cumbersome than reformatting. One of these cases and its solution are illustrated below. The use of the type unsigned int as the C_type is found in the template b_unsigned_int.tpl. The solution is to define an alias to unsigned int in the includes section section of the template using a defines statement, and then use the alias in the earlier name line.

Example template file: b_unsigned_int.tpl
The template file b_unsigned_int.tpl is quite short since most of the values that will be tested are inherited from the template b_unsigned_short. Comments beginning with "//" are used to explain what is going on.

//Note the use of the alias Uint in the C_type field
name Uint b_unsigned_int;

parent paramAccess;

includes
[
{
#include "b_unsigned_short.h"
#include <limits.h>
#define Uint unsigned int;   
// this is the line that defines the Uint alias
}
]

global_defines
[
{
}
]

dials
[

enum_dial HVAL : MAXUINT;

]

access
[

MAXUINT
{
_theVariable=-UINT_MAX;
}

]

commit
[
]

cleanup
[
]