definition of standard ISaGRAF data
Çàãîëîâîê ôóíêöèè:
/* Ôàéë: GRUS0255.h - user C function definitions - Name: sample */
/* definition of standard ISaGRAF data types */
typedef long T_BOO;
typedef long T_ANA;
typedef float T_REAL;
typedef long T_TMR;
typedef char *T_MSG;
/* definition of the calling and return parameter structure */
typedef struct {
T_ANA _par1; /* calling parameter #1 */
T_ANA _par2; /* calling parameter #2 */
T_ANA _sum; /* return parameter */
} str_arg;
/* identifiers used to access call and return parameters */
#define PAR1 (arg->_par1)
#define PAR2 (arg->_par2)
#define SUM (arg->_sum)
/* end of file */
Íèæå ïðèâåäåí èñõîäíûé "C" êîä ôóíêöèè. Ïðîãðàììèñò âðó÷íóþ ââîäèò òîëüêî òå ñòðîêè, êîòîðûå íàáðàíû æèðíûì øðèôòîì.
/* Ôàéë: GRUS0255.c - user C function - Name: SAMPLE */
#include "tasy0def.h" /* required for types definition */
#include "grus0255.h" /* C function source header */
/* C main service: calculates the addition */
void USP_sample (str_arg *arg)
{
SUM = PAR1 + PAR2;
}
/* declaration service required for dynamic link with ISaGRAF kernel */
UFP uspdef_sample (char *name)
{
strcpy (name, "SAMPLE");
return (USP_sample);
}
/* end of file */
Ñîäåðæàíèå Íàçàä Âïåðåä