How do define a user format file
1.
"#" means comment, like \\ in C++
"@" means comment, same as #. but if followed by "include", it means include another file.
2.
"@include file_name " means include another format file file_name.
3.
"<format type: format name: format ID> "
format type can be table or descriptor
format name is a string like 'CAT'
format ID is tableID or descriptor tag
4.
"{" means sub body start
"}" means sub body end
5.
"[keyword] "
keyword always in [] ,only keywork can be in []
keyword can be 'loop' 'if' 'else' or 'descriptor'
6.
"formula"
currently formula support '+'-'*'/'=', and they all has same priority, if you want to change the priority, please use "(" and ")" . formula can be nest,like (A+B-(C*D)-10) .
Note: all the parameter A B C D must be able founded in privious content.
7.
"[loop : name](formula)
{
}"
means it's a loop subbody, and the total loop lenth in byte is calculate from formula
loop key word is special, can have a name string,means what this loop is.
but name is optional,if there is no name, will consider subbody as brothers.
if is there is name string, will consider subbody as children of brothers with 'name string'.
8.
"[if](formula)
{
}
[else]
{
}"
means if formula != 0 goto subbody first else goto subbody second; else key and subbody is optional.
9.
"[descriptor] "
means it's descriptor here.
10.
"fieldname : formula : format "
Fieldname is a string like 'section lenth', and can be empty if you want it not display on content tree, I will treat it as a reserve field.
The field's lenth in bit is calcuate by formula, now we only support <= 255;
format is optional, can be 'b' 'd' 'x' 'c' 'm' or 's':
'b' means binnary, 'd' means decimal, 'x' means hex, 'c' means BCD code, 'm' MJD code, 's' means string;
the default is 'x'.
11.
12. screenshots