#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include "io68.h"
#include "sc68/msg68.h"
static const struct {
const char * name;
int (* init) (int *, char **);
void (* shutdown)(void);
} func[] = {
{ "paula", paulaio_init, paulaio_shutdown },
{ "ym-2149", ymio_init, ymio_shutdown },
{ "microwire", mwio_init, mwio_shutdown },
{ "mfp-68901", mfpio_init, mfpio_shutdown },
{ "shifter", shifterio_init, shifterio_shutdown },
};
const int max = sizeof(func) / sizeof(*func);
int io68_init(int * argc, char ** argv)
{
int i,err;
for ( err = i = 0; i < max; ++i ) {
if (func[i].init) {
err = func[i].init(argc, argv);
if (err) {
msg68_error("io68: failed to initialize *%s* IO plugin\n",func[i].name);
break;
}
}
}
return err;
}
void io68_shutdown(void)
{
int i;
for ( i=0; i < max; ++i ) {
if (func[i].shutdown)
func[i].shutdown();
}
}
void io68_destroy(io68_t * const io)
{
if (io && io->destroy) {
io->destroy(io);
}
}