How to write a WAV-PRG plug-in

A plug-in can contain one or more loaders, each one for a different format data is written on a tape. A loader is made of 2 parts:

  • a variable part, called conf: a struct containing some parameters that, if tweaked, allow to recognise slightly different variants of a format, and
  • a fixed part, called functions: a set of functions that read data in the desired format at various levels (bit, byte, block...). For most of the functions, default implementations are provided. If the default implementation of a function is appropriate, there's no need to write a replacement.

A plug-in should declare an array const struct wav2prg_loaders, The structure is defined as follows

struct wav2prg_loaders {
    const char *name;
    struct wav2prg_plugin_functions functions;
    struct wav2prg_plugin_conf conf;
};

The name is the name as it will be shown by the GUI. Note that it must be unique among the names of the loaders that will be loaded. The functions are pointers to functions that implement the fixed part (a NULL pointer means that the default implementation will be used). The conf is the conf that is most likely to be used, and will be used by default if the user chooses the loader.

The array, even when it contains just one valid loader, must end with an element whose name is NULL. This element does not define a loader, it just signals the end of the array.

After that, the plug-in must use the macro WAV2PRG_LOADER

 WAV2PRG_LOADER(x, major,minor,desc, loaders)

x is a unique identifier for the loader (no spaces allowed). major is the major version number (0-255). minor is the minor version number (0-255). Those 2 identify different revisions of the plug/in. desc is a textual description. loaders is the array declared above.

 

Last edit: Fabrizio Gennari 2012-10-28