pfp
pfp copied to clipboard
Add support for non-consecutive duplicate (implicit) arrays
Describe the bug
For the full story, start reading #110.
This is the second part of #110: adding support for non-consecutive duplicate arrays.
To Reproduce
This currently will not work in pfp:
char x;
char y;
char x;
char x;
char x;
char x;
char x;
In pfp, the first declared x
will receive the x_0
variable name, and all subsequent x
declarations will have an incrementing suffix added to x
:
struct {
x_0 = Char(-119 [-77])
y = Char(80 [50])
x_1 = Char(78 [4e])
x_2 = Char(71 [47])
x_3 = Char(13 [0d])
x_4 = Char(10 [0a])
x_5 = Char(26 [1a])
}
Expected Behavior
pfp should mirror 010's behavior and create a non-consecutive, duplicate array.
Implementation/Fix Notes/Thoughts
- Arrays need to not be consecutive by default - an array is just a logical grouping of fields, not a guaranteed consecutive array of fields
- Reassigning values to a non-consecutive array should preserve the original non-consecutiveness - there's not real way for the user to control this aspect.