Skip to content

Conversation

hexadecimalDinosaur
Copy link

@hexadecimalDinosaur hexadecimalDinosaur commented Aug 1, 2025

Pattern works with a few caveats, early attempts at creating a pattern used import bmp as BMP; in order to import the individual BMP and PNG structs instead of parsing an entire file, this was unsuccessful as it would trigger a BMP and PNG pattern parse from the beginning of the file.

Pattern works at parsing embedded BMP and PNG files but parses nonsense for BMP BMFH headers since they are not present in ICO files and the PNG visualizer does not work as it attempts to visualize the entire ICO file starting from the PNG offset. Attempts at setting [[fixed_size(size)]] failed.

@hexadecimalDinosaur
Copy link
Author

@WerWolv any ideas why the imports for this pattern fail in unit tests? Also, thoughts on new pattern language features to suppress the parsing of the whole file as another file types when importing structs from patterns with import bmp as BMP; notation?

@WerWolv
Copy link
Owner

WerWolv commented Aug 2, 2025

@hexadecimalDinosaur I believe you're the first one to use import * in the CI. I'll probably need to adjust the run parameters to include the pattern folder so they can be included. Adding something like import bmp as BMP; is planned but it's significantly more work than the simple import *. There's one workaround if you need it and that's the IMPORTED macro. That macro is only defined when a pattern is being imported by another one so you can #ifdef out parts of the pattern that you don't want to have run in that case. Not ideal of course but better than nothing

WerWolv added a commit that referenced this pull request Aug 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants