Quick Start Module Programming by John Vlahogiannis Translation in english by Fotis Alexandrou (2002/04/05) In order to understand some basic things about the Plugin Manager, let's say, in the begining, that we eant to insert into the API of the sound a new command, ising(). The things we must do are the following: 1. We open pml.c and under the // optional - OSD_SOUND_DEV, we declare modif->routines.osd.ising = dl_optional_getfuncptr(modinf, "pm_osd_ising"); 2. We open vram.c (that's because when we meet the escape character \z we want to sound a beep-beep)and we add in: void vr_print(const char *str) /*into the switch*/ case '\z': dev_beep(); dev_beep(); break; Of course we can call any function we want except dev_beep(). There may be some other stuff that have to be done but I don't remeber them ;-). One way or another, when looking a module and following the included files, it is not difficult to make a module. To make a module, the basic parts in where we must declare it are (if I remember well) 1. In pm_app.c ---- Looking at the osd_module we make something like that [if not using copy and paste :-) ] We must not forget and a release routine !!! 2. We #include our module into pm_mid.h (eg. #include "pmspeech_module.h") 3. In pml.h we add #include "pm_speech_module.h" Naturally, the next step is to exam a little what has to contain the pm_speech_module.h . Another time, I will explain exactly each on every header file that exists in a module but the target of this tutorial is to be someone able to build a module quickly without complexing every function of PM. Of course, I may have forgotten to write many things in this tutorial but it is surely a start!!! Feedback is welcomed !!! And after this break we go on!!! Here's how a pm_speech_module.h must be: /* * pm_speech_module.h: Purpose of module * * Module Programmer - Date */ #if !defined(_pm_speech_module_h) #define _pm_speech_module_h #include "pm_module.h" #if defined(__cplusplus) extern "C" { #endif typedef struct { // Maybe this struct should // be joined with the next struct ? int version; // version of this structure } pm_osd_sysinfo_t; // And pm_osd_sysinfo_t should // change to pm_sound_sysinfo_t // typedef struct { mid_t mid; // used for user // interface and I DONT // WANT 2 STRUCTURES OF // THE SAME THING void (*sysinfo)(mid_t mid, pm_osd_sysinfo_t *); void (*ising)(mid_t mid); // ising was made // earlier- look up // of course we can place all the functions //of our module here } pm_osd_routine_table_t; void pm_osd_ising(mid_t mid); #if defined(__cplusplus) } #endif #endif Of course the mistake here is that even if we are talking for a sound module, our functions must be in a pm_osd_..., while they should be written in a pm_snd_module. It is not a syntax error but generally, let there be a general division between vfs, osd and snd. That's it... Even if this is a draft and messed-up tutorial, it may be a little helpful, without getting into details of PMlike in the communicating trick of PM and modules via shared memory or unix sockets (if the application runs on the same system ...) which is easy for anyone to see if notices that all the calls are pointers to structures... If there are any bugs, is that this text document was written on Windows, and the translator was drinking beer instead of coffee, while he was listening to Slipknot and Sytem of a Down ;-))))