WerWolv / WerWolv/PatternLanguage
format/format_entries does not work with a template with non-type values (and an @)
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 275
- Forks
- 75
- Avg merge
- 1d 22h
- Merged PRs (30d)
- 10
Description
Originally reported here: https://github.com/WerWolv/ImHex-Patterns/issues/147 - but closed due to wrong repository.
Consider the following file:
10 00 00 00 18 00 00 00 04 00 00 00 FF FF FF FF FF FF FF FF FF FF FF FF 74 65 73 74 31 32 33 34 35 6C 6F 6C 31 33 33 37 08 00 00 00 04 00 00 00 0C 00 00 00 05 00 00 00 11 00 00 00 03 00 00 00 14 00 00 00 04 00 00 00
With the following pattern:
fn entryName(auto e) {
return e.name;
};
struct Entry<auto offset> {
u32 nameOffset;
u32 nameSize;
char name[nameSize] @ offset + nameOffset;
}/*[[format("entryName")]]*/;
struct Header {
u32 blockOffset;
u32 nameBlockSize;
u32 numberOfElements;
Entry<blockOffset> entries[numberOfElements]
@ blockOffset + nameBlockSize
//[[format_entries("entryName")]]
;
};
Header header @ 0x0;
Basically, this file requires the entry to know where the lookup table for the strings is located. I've used a template for that. The original issue was about not being to use a template in a format-function, but auto solves that. However, this particular file and pattern causes an error[E0011] when you try to use either of the format attributes.
I'm pretty sure it's related to the @ sign throwing things off.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the error using the supplied test.zip and pattern, focusing on format and format_entries with the templated Entry and @ expressions. Trace the handling of these format attributes and confirm done when both attributes work without error[E0011] for this example.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100