Skip to content

swf: Re-organize Tag type and reader/writer methods #10456

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

Herschel
Copy link
Member

@Herschel Herschel commented Mar 30, 2023

Doing some spring cleaning of swf. This is mostly busy-work with no functional change.

  • Make all variants of Tag follow the pattern of Tag::TagName(TagStruct).
    • Previously most were structs already, but some were inline fields Tag::TagName { foo, bar }.
    • Make this consistent both for aesthetics and for ease of use (a struct per variant allows you to pass it to a function, add methods on the struct itself, etc.).
  • Move Tag to tag.rs.
  • Re-arrange the Reader/Writer methods.
    • Previously there was a lot of chunky code blocks in the massive match statements.
    • Now every tag variant has a read_foo/write_foo method.
    • Alphabetized Tag + roughly organized methods.
  • Remove uses of ref in Writer.

The motivation is I'm working towards finally adding support for streaming all of the tags/bytecode in swf.

Move `Tag` into separate module and alphabetize variants.
For consistency, all variants of `Tag` now follow the convention of
`Tag::TagName(TagName)`, where `TagName` is a non-tuple struct.

`Reader` now has separate functions for reading each specific tag.
Some variants do, so make this consistent for all variants.
@danielhjacobs danielhjacobs added T-refactor Type: Refactor / Cleanup swf Related to the SWF format A-other Area: Not covered by other area labels labels Sep 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-other Area: Not covered by other area labels swf Related to the SWF format T-refactor Type: Refactor / Cleanup
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants