Skip to content

Conversation

@gucio321
Copy link

Hi there
I'm a maintainer of https://github.com/AllenDang/cimgui-go which uses this project via https://github.com/gucio321/cimmarkdown.

Would you be so kind to add this tiny change to make my generator work correctly on the upstream repo (I'd not need to maintain my fork) 🙏 Thank you in advance!

Added brackets around names of callbacks typedefs.

This is for compatibility with https://github.com/gucio321/cimmarkdown

IIRC there was a problem to distinguish between callbacks typedefs and something else (cant remember what exactly). If you wish I can make the research again and tell what exactly was the problem

Added brackets around names of callbacks typedefs.

This is for compatibility with https://github.com/gucio321/cimmarkdown

IIRC there was a problem to distinguish between callbacks typedefs and something else (cant remember what exactly)
@dougbinks dougbinks self-requested a review June 26, 2025 10:14
@dougbinks dougbinks self-assigned this Jun 26, 2025
@dougbinks dougbinks added the enhancement New feature or request label Jun 26, 2025
@dougbinks
Copy link
Member

I'm not very fond of the extra syntactic sugar used here, but if it solves a real problem I'll consider it.

Do you know if it's possible to fix the generator so it correctly detects the typedef at the start of the lines in question?

@dougbinks
Copy link
Member

dougbinks commented Jun 26, 2025

The generator has this line:

https://github.com/gucio321/cimmarkdown/blob/master/generator/cpp2ffi.lua#L330

Which correctly detects the current syntax, but also the function pattern:

https://github.com/gucio321/cimmarkdown/blob/master/generator/cpp2ffi.lua#L319

Which also matches.

It looks like the parseItems loops through each pattern in turn, finding the first match. So I think one simple solution might be to move the functypedef_re expression above the function_re ones so that the typedef is found first and the generator breaks out of its search loop.

Fixing the generator this way, if possible, would be the preferred more future proof route in my view.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants