$compact
alphonse$code: DO;

$if r_32
	DECLARE	SIZE$OF$OFF_SET	LITERALLY	'DWORD';
$else
	DECLARE	SIZE$OF$OFF_SET	LITERALLY	'WORD';
$endif

DECLARE token				LITERALLY			'SELECTOR';
DECLARE alphonse$ds			WORD PUBLIC;

$include(:rmx:inc/nuclus.ext)
$include(:rmx:inc/eios.ext)
$include(:rmx:inc/hi.ext)

alphonse: PROCEDURE PUBLIC;

DECLARE CR 						LITERALLY	'13';
DECLARE LF						LITERALLY	'10';
DECLARE wait$forever			LITERALLY	'0FFFFH';
DECLARE FOREVER					LITERALLY	'WHILE 1';
DECLARE calling$tasks$job		TOKEN;
DECLARE master$mbox				TOKEN;
DECLARE response$mbox			TOKEN;
DECLARE status					WORD;
DECLARE type$code				WORD;
DECLARE time$limit				WORD;
DECLARE seg$token				TOKEN;
DECLARE seg$size				SIZE$OF$OFF_SET;
DECLARE display$message(*)		BYTE		DATA(
	CR,LF, 'After you, Gaston', CR, LF);
DECLARE message BASED seg$token	STRUCTURE(
					count		BYTE,
					text(25)	BYTE);

	time$limit = 25;						/* Delay factor for message	*/
											/* display					*/
											/* Size of message segment	*/
	calling$tasks$job = SELECTOR$OF(NIL);	/* Directory in which to	*/
											/* look up obj				*/

	master$mbox = RQ$LOOKUP$OBJECT (		/* Look up message			*/
		calling$tasks$job,					/* mailbox					*/
		@(6,'master'),
		wait$forever,
		@status);

	DO FOREVER;

	   seg$token = RQ$RECEIVE$MESSAGE (		/* Receive response			*/
		master$mbox,						/* from Gaston				*/
		wait$forever,
		@response$mbox,
		@status);

	   type$code = RQ$GET$TYPE (			/* See what kind of			*/
		seg$token,							/* object it is				*/
		@status);

	   IF type$code <> 6 THEN				/* If it isn't a			*/
		CALL RQ$EXIT$IO$JOB (				/* segment, exit			*/
			0,
			NIL,
			@status);

	   message.count = 21;
	   CALL MOVB (@display$message, @message.text, SIZE(display$message));

	   CALL RQ$C$SEND$CO$RESPONSE (			/* Send message to			*/
		NIL,								/* screen					*/
		0,
		@message.count,
		@status);

	   CALL RQ$SLEEP (						/* Wait a while to			*/
		time$limit,							/* give user time to		*/
		@status);							/* see the message			*/

	   CALL RQ$SEND$MESSAGE (				/* Send message to			*/
		response$mbox,						/* response mailbox			*/
		seg$token,
		SELECTOR$OF(NIL),
		@status);

	   END;									/* FOREVER					*/
	END alphonse;
END alphonse$code;
