Device Monitoring Studio - TODO
Docs

Language Reference

Device Monitoring Studio supports advanced structure definition syntax. It is based on the Standard C type definition syntax and extends it in a number of ways.

While Standard C only allows defining static types, that is, data structures which size and memory allocation is strictly defined at compile time, Device Monitoring Studio extends the syntax to allow definition of dynamic types. The following code illustrates this:

struct StaticType
{
    int Array[128];
};

struct DynamicType
{
    int ArraySize;
    
    // invalid in Standard C (non const expression), valid in Device Monitoring Studio
    int Array[ArraySize / sizeof(int)]; 
};

The DynamicType structure definition is valid in Device Monitoring Studio. The size of the structure is determined at the time it is bound to the data and the number of elements in Array array varies.

Workflow

Device Monitoring Studio compiles all protocol definition files in its library on each application start. A preprocessor is run on each source file. It is responsible for the following tasks:

Multiple files are pre-processed and compiled in parallel if Device Monitoring Studio is running on multi-processor and/or multi-core computer.

Tokenization

Source files are tokenized according to standard C language rules: there must be one or more space characters between tokens if they cannot be distinguished without spaces and there may optionally be one or more spaces between tokens if they are distinguishable without spaces.

Space is a space character (' '), tabulation ('\t'), newline ('\n') or comment.

int a;              // valid, space is used to separate tokens "int" and "a"
int/* comment */a;  // valid, comment  is used to separate tokens "int" and "a"
inta;               // invalid, compiler cannot distinguish between "int" and "a" and parses it as "inta"
int                 // continued on the next line…
     a              // still continued…
          ;         // valid, newline is valid space character
    
a & b               // valid, space is used to separate "a" and "&" and "&" and "b"
a&b                 // still valid, space is not required - compiler is able to 
                    // distinguish between "a" (identifier) and "&" (operator)

Space must not be used inside a keyword, such as built-in type int or operator &&:

in t a;       // invalid, "int" must not contain space
a & & b       // valid, but will be parsed as a & (&b)
a | | b       // invalid, space inside keyword (operator "||")