Re: [RFC] Register sets

Jim Blandy
2003-09-09T17:15:53Z

Andrew Cagney <ac131313@redhat.com> writes:

> > Daniel Jacobowitz <drow@mvista.com> writes:
> >
> >> struct regset
> >> {
> >> void (*supply_regset)(struct regcache *, const void *, size_t, int);
> >> void (*read_regset)(struct regcache *, void *, size_t, int);
> >> };
> > If you want to allow people to define regset formats via the CLI, it
> > seems to me you probably want some kind of closure argument in there,
> > like this:
> > struct regset
> > {
> > /* Always pass this to the supply_regset and read_regset
> > functions below as their first argument. */
> > void *closure;
> > void (*supply_regset)(void *closure,
> > struct regcache *, const void *, size_t, int);
> > void (*read_regset)(void *closure,
> > struct regcache *, void *, size_t, int);
> > };
> > This gives you the hook you need to have a single function for all
> > CLI-defined regsets, interpreting the layout the user supplies to the
> > CLI command.
>
> Er, this isn't a closure (at least not in the sense specified on
> bfd@). Rather this is an object and so might as well be implemented in
> more of an object style - pass the "struct regset" as the first
> parameter.

Not sure I think the distinction is too meaningful. You should
probably post a specific suggestion that shows what you're after.