Include (or some variant of it) is very much on the todo-list!
I don't think a C-preprocessor "copy-paste"-styled include would be the best though. Say you have:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15 | // In formatA.bet
struct Header
{
string(4) magic;
u(4) version;
...
};
struct File
{
Header header;
...
};
layout File;
|
1
2
3
4
5
6
7
8
9
10
11
12
13 | // In composite.bet
include("formatA.bet");
include("formatB.bet"); // Also defines type File and does layout
struct CompositeFile
{
// What type is what here?
File fileOfTypeA;
File fileOfTypeB;
};
layout CompositeFile; // Is this layout done after the included files? Is the included files not doing layout?
|
Include is also a feature that is needed before some of the incoming major addition to the layout language, so it's somewhat high on the todo list.
I'm currently leaning on a more Python like include, like:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15 | include(A="formatA.bet");
include("formatB.bet");
// or maybe even:
include(A = "formatA.bet", "formatB.bet")
struct CompositeFile
{
// Dot is getting very overloaded so might be something like : instead...
A.File fileA;
formatB.File fileB;
};
layout CompositeFile;
|
and only run layout commands if it's the "main" file being executed.
This is currently very much in idea phase so any suggestions would be highly appreciated.