Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
    Arkadiusz Bulski
    @arekbulski
    I dont have a patreon page anymore... neither a Paypal account since they added fees for not using it. Thanks for the offer tho.
    When you are done, PR your stuff to the gallery maybe?
    Phillip Heller
    @pheller
    Sure
    Arkadiusz Bulski
    @arekbulski
    Wanna tell me more what it is that you are doing?
    Just curious.
    Phillip Heller
    @pheller
    I'm trying to parse a local cache file format from a long gone online-service from the 80s and 90s called Prodigy. The on-disk cache was very similar in layout to FAT12 used for floppy disks.
    Arkadiusz Bulski
    @arekbulski
    Oh wow, it sounds like you are digging dinosaur fossils out...
    Phillip Heller
    @pheller
    The problem in using BitsInteger(12) is that the bits which constitute the integer are not contiguous.
    I am definitely digging into really really old stuff.
    Arkadiusz Bulski
    @arekbulski
    Regarding the non continous bitsintegers: you can use Bytes inside BitStruct, read all these separately, then use a custom class to process it.
    Its work but its doable.
    Phillip Heller
    @pheller
    Ok, I'll look into doing it that way. Thanks for the recommendation.
    Arkadiusz Bulski
    @arekbulski
    You can write a custom class that will accept "this expressions" that concatenate different fields from the context.
    This is a somewhat advanced stuff. You need to read up on it.
    Ruslan0Dev
    @Ruslan0Dev
    Hi everyone!
    How to customize print like:
    {offset1} - {offset2} {length} {item_name} = {item_value}
    example:
    0 - 31 32 header
    0 - 3 4 \t name = test
    4 - 7 4 \t index = 1234
    Arkadiusz Bulski
    @arekbulski
    I dont even understand the question.
    Customize what?
    Ruslan0Dev
    @Ruslan0Dev

    Customize what?

    default "printer"
    print(m.parse_stream(fp))

    Arkadiusz Bulski
    @arekbulski
    I dont know if you can do that at all.
    You would need to rewrite the entire Struct class top to bottom.
    Ruslan0Dev
    @Ruslan0Dev

    You would need to rewrite the entire Struct class top to bottom.

    :(
    First look (class sources) - difficult-code))
    I found RawCopy (data, value, offset1, offset2, length fields), but it is only for the first level.
    I wanted this for all objects (Container, ListContainer, keys\values)

    Arkadiusz Bulski
    @arekbulski
    Sorry, you are not talking sense.
    Arkadiusz Bulski
    @arekbulski
    I think what you need is to rewrite the entire Struct class...
    Ruslan0Dev
    @Ruslan0Dev

    Real example:
    MediaInfo (MediaTrace) output
    mediainfo --Details=1 --Output=XML example.wav

    output part
    <block offset="0" name="Header" size="12">
    <data offset="0" name="Name">RIFF</data>
    <data offset="4" name="Size">171654</data>
    <data offset="8" name="Real Name">WAVE</data>
    </block>

    Arkadiusz Bulski
    @arekbulski
    Yeah, difficult code for some... some people wrote me patches that were excellent code and they didnt have issues understanding the code.
    Ruslan0Dev
    @Ruslan0Dev
    For a quick inspection - difficult) In any case, thanks for the useful tool. I will think: write my own parser or try to rewrite classes.
    Arkadiusz Bulski
    @arekbulski
    Good luck. Remember you can always ask for more help... just please post things as Issues. Chat is not read by that many people I think.
    Arkadiusz Bulski
    @arekbulski
    More over, the chat is not searchable for anyone. Issues are archived. Thats why.
    celestinjr
    @celestinjr

    Hi, I'm having trouble comparing an enum in an 'If' construct. Is this supported? When i run the following:

    c.If(c.this.display_flag == enum_wpt_display.route_point_detailed,
    c.Struct('offset1' / c.Tell,
    c.Probe())

    I get the following exception 'NameError: name 'route_point_detailed' is not defined'

    I've also tried comparing the enum 'intvalue' properties without success

    display_flag is an enum as defined by the following:
    enum_wpt_display = c.Enum(c.Int32sl, hidden=0, icon_only=1, icon_name=2, route_point_simple=4, route_point_detailed=5)
    Arkadiusz Bulski
    @arekbulski
    try equating with 5 directly
    otherwise I suggest you open an Issue for it
    Arkadiusz Bulski
    @arekbulski
    you could also try lambdifying it: If(lambda this: .....)
    celestinjr
    @celestinjr
    will try that thanks
    John Doe
    @k4w4b4ng4_gitlab
    hi guys, I'm trying to parse little-endian BitStruct and I can't understand the rational behind the semantics
    I would expect that the same layout would work for big-endian, would work for little-endian just by wrapping BitStruct with ByteSwapped
    current semantics expects the declaration to be in reversed order than how the bitfield would look in c/cpp
    Arkadiusz Bulski
    @arekbulski
    I havent dealt with this for a while so I might be wrong on this but...
    I think BitStruct might not be sizeof()-able which is a prerequisite for ByteSwapped.
    But then I might be wrong on this.
    I dont understand your last sentence...
    John Doe
    @k4w4b4ng4_gitlab
    I'll rephrase
    the order of fields shouldn't be most significant bits to least?
    @arekbulski
    and if not, what is the rationale in the difference between LE and BE
    Arkadiusz Bulski
    @arekbulski
    I am not the best person to help you (despite me being the sole developer eh).
    I advise that (1) you create an Issue and (2) you provide some example code.
    John Doe
    @k4w4b4ng4_gitlab
    it's not necessarily an issue, I might just miss the rationale
    Arkadiusz Bulski
    @arekbulski
    Another thing that occured to me...
    If you wrap entire BitStruct with a ByteSwapped then you reorded bytes within entire struct, not each element independently.