Definition | #include <cont.h> void cenaco(struct enacop *enacopar);
For detailed information on contingency routines, refer to chapter “Contingency and STXIT routines” and the "Executive Macros" manual. | ||||||||||||||
Parameters | struct enacop *enacopar Pointer to a structure that is defined in <cont.h> as follows: struct enacop { char resrv1 [7]; /* reserved for int. use */ char coname [54]; /* name of cont. routine */ char resrv2 [15]; /* reserved for int. use */ char level; /* priority of cont.rout. */ int (*econt)(struct contp); /* start adr of cont.rout. */ int comess; /* contingency message */ int coidret; /* contingency identifier */ errcod secind; /* secondary indicator */ char resrv3 [2]; /* reserved for int. use */ errcod rcode1; /* return code */ }; #define errcod char #define _norm 0 /* normterm */ #define _abnorm 4 /* abnormend */ #define _enabled 4 /* codefenabled */ #define _preven 12 /* coprevenabled */ #define _parerr 16 /* coparerror */ #define _maxexc 24 /* comaxexceed */ Some of the entries in the parameter structure can or must be supplied by you prior to the cenaco call; other entries are used by cenaco to store information during the run. Entries supplied by the user:
Entries supplied by
| ||||||||||||||
Note | A maximum of 255 contingency routines can be defined. | ||||||||||||||
Example | Program fragment for the definition of a contingency routine: #include <cont.h> /* Contingency routine: controut */ int controut(struct contp contpar) { . . . printf("Contingency message: %d\n", contpar.comess); . . . } /* Main routine in which the controut routine is defined as a contingency routine. */ int main(void) { . . . struct enacop enacopar; . . . enacopar.econt = controut; enacopar.level = 1; enacopar.comess = 100; strfill(enacopar.coname, "CONTPROC1 ", sizeof(enacopar.coname)); cenaco(&enacopar); . . . } | ||||||||||||||
See also | cdisco, cstxt, signal, alarm, raise, sleep |