Your Browser is not longer supported

Please use Google Chrome, Mozilla Firefox or Microsoft Edge to view the page correctly
Loading...

{{viewport.spaceProperty.prod}}

cenaco - Definition of a contingency routine

&pagelevel(4)&pagelevel

Definition

#include <cont.h>

void cenaco(struct enacop *enacopar);

cenaco defines a contingency routine (TU or P1). This means that a routine written by the
user can be assigned as a contingency routine by means of cenaco.

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:

coname

Name of the contingency process. The name is a maximum of 54 bytes long (without null byte), must be in uppercase and must terminate with at least one blank (a null byte immediately after the actual name is not recognized as an end criterion by the system). The strfill function, for example, is suitable for supplying coname (see also example).
This input is mandatory.

level

Priority level of the contingency process. This input is mandatory. Values from 1 - 126 are legal.

econt

Start address of the contingency routine. This input is mandatory.

comess

Contingency message. This input is optional. The value is passed to the contingency routine as a parameter.

Entries supplied by cenaco:

coidret

Short ID of the contingency process. This short ID must be used in further macros (e.g. SOLSIG) for the identification of the contingency process.

secind

"Secondary indicator", as stored in the most significant byte of register 15 (values 4, 12, 16 or 24) after execution of the ENACO macro.

rcode1

"Return code", as stored in the least significant byte of register 15 (value 0 or 4) after execution of the ENACO macro.

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