Convert::Binary::C does not process function pointers
Nobody has claimed this yet.
- Dominant language
- Perl
- Stars
- 13
- Forks
- 8
- PR merge metrics
- No merged PRs in 30d
Description
Currently I am playing with the PipeWire library and am having fun parsing its headers and even generating Perl code from the definitions I get from Convert::Binary::C. One thing is missing, though: PipeWire has structures containing function pointers, these are represented as plain data fields.
For example, when I parse this structure (I removed the comments from the original source):
struct pw_context_events {
#define PW_VERSION_CONTEXT_EVENTS 1
uint32_t version;
void (*destroy) (void *data);
void (*free) (void *data);
void (*check_access) (void *data, struct pw_impl_client *client);
void (*global_added) (void *data, struct pw_global *global);
void (*global_removed) (void *data, struct pw_global *global);
void (*driver_added) (void *data, struct pw_impl_node *node);
void (*driver_removed) (void *data, struct pw_impl_node *node);
};
...I get (from CBC's sourcify output for brevity):
#line 53 "/usr/include/pipewire-0.3/pipewire/context.h"
struct pw_context_events
{
uint32_t version;
void *destroy;
void *free;
void *check_access;
void *global_added;
void *global_removed;
void *driver_added;
void *driver_removed;
};
Is there any way to find out that these are actually function pointers? What I'm actually after is the subroutine signatures: These pointers are callback routines which I want to implement in Perl.
This is not a showstopper: Right now I parse the signatures manually (after all, this is Perl) and use CBC to unravel the structures. It just feels weird to do my own parsing of header files which have been already parsed by CBC..
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
Start by tracing how Convert::Binary::C parses C declarations and how its sourcify output represents the function-pointer fields in the shown PipeWire structure. Compare the callback declarations with the generated output; done means function-pointer fields retain their signatures so their subroutine arguments can be identified.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- c, perl
- Domain
- compilers, devtools
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100