On Wed, 7 Feb 2001, Richard A. Smith wrote:
> superio[0]->init();
> superio[0]->serial_device[0]->set_baud(BD_9600)
This array of structs is the kind of thing that the config tool can build.
One example:
You have two files, my_superio.c and your_superio.c. Inside these define
a bunch of standard functions. The only hook into these files is via a
struct. This is really common stuff, it's how VFSes are done in most Unix
systems (and Linux).
So we have:
struct superio my_superio { void (*init)(); void (*fixup()); }
and my_superio.c defines:
struct superio my_superio { init, fixup};
Since this is in file scope, my_superio gets init and fixup for itself.
Same for your_superio
struct superio your_superio {init, fixup};
The init and fixup are declared static. The only global is the structure
itself. The config tool can pick these up and generate cools as Richard
showed above.
Another possibility is linker sets but these drive me crazy.
ron