Your Browser is not longer supported

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

{{viewport.spaceProperty.prod}}

Example of a complete C program unit

The following is an example of an executable KDCS program unit in the C programming language.
The program outputs the text "hello world !" and the names of the logical terminals.

Program mhello
#include <kcmac.h>
struct work {
       union kc_paa call_pb;
       char   buffer[400];
      };
struct kc_ca {
       struct ca_hdr kopf;
       struct ca_rti rfld;
       char   kcprg[500];
      };
#define NB     spab->buffer
#define KBKOPF kb->kopf
#define KBRFLD kb->rfld
#define PB     spab->call_pb
void mhello ( struct kc_ca *kb, struct work *spab )
{
   /* KDCS interface initialization */
   KDCS_SET( &PB, &KBKOPF, &KBRFLD );
   /* INIT - Call */
   KDCS_INIT( sizeof(struct kb->kcprg), sizeof(struct work) );
   /* MPUT-NT - Call   */
   strcpy ( NB, "hello world !\n\n" );
   KDCS_MPUTNT( NB, (short)strlen(NB), KDCS_SPACES,
                KDCS_SPACES, KCNODF );
   /* MPUT-NT - Call   */
   sprintf ( NB, "lterm = %.8s \n", KBKOPF.kclogter );
   KDCS_MPUTNT( NB, (short)strlen(NB), KDCS_SPACES,
                KDCS_SPACES, KCNODF );
   /* PEND-FI - Call   */
   KDCS_PENDFI();
}