ISaGRAF. Version 3.4


C - 11


/* function block (xxx is the name of the function block) */

 

#include <tasy0def.h>

#include <grfb0nnn.h> /* nnn is the number of the f.block in library */

 

/* structure of hidden data for each instance of the block */

typedef struct {

/* fields definition */

} str_data;

 

/* initialization service: returns the size of needed hidden data */

word FBINIT_xxx (uint16 hinstance)

{

return (sizeof (str_data));

}

 

/* activation service: processes the calling parameters */

void FBACT_xxx (uint16 hinstance, str_data *data, str_arg *arg)

{

/* ... */

}

 

/* cast operation used to copy the value of a return parameter */

#define BOO_VALUE ((T_BOO *)value)

#define ANA_VALUE ((T_ANA *)value)

#define REAL_VALUE ((T_REAL *)value)

#define TMR_VALUE ((T_TMR *)value)

#define MSG_VALUE ((T_MSG *)value)

 

/* return parameters read service: called for each return parameter */

void FBREAD_xxx (uint16 hinstance, str_data *data, uint16 parno, void *value)

{

switch(parno)

{

case FBLPNO_XX: *???_VALUE = ...; break;

case FBLPNO_YY: *???_VALUE = ...; break;

....

}

 

/* . ISaGRAF, . ISaGRAF*/

 

ABP fbldef_xxx (char *name, IBP *initproc, RBP *readproc)

{

strcpy (name, "XXX");

*initproc = (IBP)FBINIT_xxx;

*readproc = (RBP)FBREAD_xxx;

return ((ABP)FBACT_xxx);

}

 

/* end of file */

TASY0DEF.h ISaGRAF . , , .

C