pfp icon indicating copy to clipboard operation
pfp copied to clipboard

Add support for non-consecutive duplicate (implicit) arrays

Open d0c-s4vage opened this issue 5 years ago • 0 comments

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:

image

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.

d0c-s4vage avatar Jan 07 '20 05:01 d0c-s4vage