Hex Editor Neo 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, Hex Editor Neo 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 Hex Editor Neo
int Array[ArraySize / sizeof(int)];
};
The DynamicType
structure definition is valid in Hex Editor Neo. 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.
Hex Editor Neo 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:
#include
directives and building the dependency graph.Multiple files are pre-processed and compiled in parallel if Hex Editor Neo is running on multi-processor and/or multi-core computer.
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 "||")