previous next Up Title Contents

Module Specification

The modgen can be called with a module specification file as an argument, otherwise it will prompt for the file when it starts. Both methods of calling the program are shown below:

modgen

modgen file.mod

The layout of the module specification file, "file.mod", is very similar to a standard ANSI-C typedef structure declaration with the addition of a few keywords, i.e.

/* Comment */

mod_name ModuleName;

qualifier ModuleQualifier;

proc_routine ProcessRoutineName;

typedef struct {

...Parameter declarations...

} StructureName;

Figure [20] Module Specification Format.

- keywords are shown in bold-face and the identifers, or names, are given as italics. The standard ANSI-C type specifiers are available for declaring the module parameters, e.g. 'char', 'int', 'float', 'double', and so on. An example showing the module specification for the "AnAutoCorr" module is shown below in figure [21].

/* This is the module specification for the AnAutoCorr module

*/

mod_name Analysis;

qualifier ACF;

proc_routine Calc;

typedef struct {

int normalisationMode;

double timeOffset;

double timeConstant;

double period;

} AutoCorr;

Figure [21] Example Module Specification.

The special key words using by the modgen program are given below in table [1].

Table [1] Module Specification key words.

Keyword

Description
Example
mod_name
This keyword specifies the base name of the module. It must be declared, as it appears as the base name for all the module routines, separated from the function name by an underscore.
PrintPars_ModuleName(void)
qualifier
This keyword specifies an additional qualifier for the modulename.Thisdeclaration is optional, but if declared it will appear after the base name of the module in all module routines, separated by anunderscore.
PrintPars_ModuleName_Qualifier(void)
proc_routine
specifies the name to be given to the main process routine, i.e. the routine which actually generates the output signal. If it is not declared then the default name "Process" will be given.
Process_ModuleName_Qualifier(...)
int_al
This is a special form of the standard ANSI_C 'nt type. The "_al" stands for' array limit', as it is used to indicate that the respective parameter is to be used as the array length for any following array declara- tions (see the example for the StMPTone module specification file in the crl208 directory). Only one parameter will be used for int_al declaration lines, and it will be applied as the array limit for all pointers thereafter declared, until the next int_al declaration.

If an error is encountered in the module specification file the program will exit, trying to indicate the approximate line position of the error.

When declaring module parameters, combinations such as 'unsigned int' will not be interpreted correctly. This problem can be circumvented by introducing a typedef before the main module structure declaration, e.g. "typedef unsigned int uint", then use "uint" as the type name.


previous next Up Title Contents