dissect.cstruct_legacy icon indicating copy to clipboard operation
dissect.cstruct_legacy copied to clipboard

Comments in structures prevents structure to parse.

Open Hadatko opened this issue 6 years ago • 2 comments

Hi, this structure isn't parsed and it is skipped (when most of comments are removed, structure is parsed properly):

struct acSensorArrayData
{
    //Accelerometer
    //{
    uint16_t accelerationX;

    uint16_t accelerationY;

    uint16_t accelerationZ;
    //}

    //Proximity
    //{
    uint8_t proxyEvents;

    uint8_t touchByte;

    uint8_t touchHalfByte;
    //}

    //BME 680
    //{
    uint16_t gas;

    uint16_t humidity;

    uint16_t temperature;

    uint16_t pressure;
    //}

    //Luxmeter
    //{
    uint32_t lux;
    //}

    //Battery
    //{
    uint16_t chargerState;

    uint8_t chargeStatus;
    //}

    //GPIO expander
    //{
    uint8_t gpioExpInput;
    //}
};

Hadatko avatar Dec 19 '19 08:12 Hadatko

What would be your expected parsed result? I assume the following:

struct acSensorArrayData
{
    uint16_t accelerationX;
    uint16_t accelerationY;
    uint16_t accelerationZ;
    uint8_t proxyEvents;
    uint8_t touchByte;
    uint8_t touchHalfByte;
    uint16_t gas;
    uint16_t humidity;
    uint16_t temperature;
    uint16_t pressure;
    uint32_t lux;
    uint16_t chargerState;
    uint8_t chargeStatus;
    uint8_t gpioExpInput;
};

Schamper avatar Dec 19 '19 13:12 Schamper

Yes. I found out that issue is this //} comment. I created pull request for you.

Hadatko avatar Dec 19 '19 15:12 Hadatko