#define __NEW_STARLET 1
#include <stdio.h>
#include <stdlib.h>
#include <ssdef.h>
#include <stsdef.h>
#include <lib$routines.h>
#include <starlet.h>
#include "errchk.h"
#define trigger_ast(arg) r0_status = sys$dclast (ast_routine, arg, 0); \
if (r0_status != SS$_NORMAL) \
(void)lib$signal (r0_status);
static void ast_routine (int arg) {
(void)printf ("In ast_routine (): message %d\n", arg);
}
int main (void) {
static int r0_status;
r0_status = sys$setast (1);
errchk_sig (r0_status);
trigger_ast (1);
(void)printf ("Note this will appear after message 1\n");
r0_status = sys$setast (0);
errchk_sig (r0_status);
trigger_ast (2);
(void)printf ("Note this will appear before message 2\n");
r0_status = sys$setast (1);
errchk_sig (r0_status);
}