Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Path: utzoo!mnetor!seismo!mcvax!ukc!pc
From: pc@ukc.ac.uk (R.P.A.Collinson)
Newsgroups: comp.sys.atari.st
Subject: Re: Can you tell when GEM has booted?
Message-ID: <2279@eagle.ukc.ac.uk>
Date: Thu, 11-Dec-86 14:48:14 EST
Article-I.D.: eagle.2279
Posted: Thu Dec 11 14:48:14 1986
Date-Received: Mon, 15-Dec-86 05:46:49 EST
References: <655@bath63.ux63.bath.ac.uk>
Reply-To: pc@ukc.ukc.ac.uk (R.P.A.Collinson)
Distribution: comp.sys.atari.st
Organization: U of Kent at Canterbury, Canterbury, UK
Lines: 42
Keywords: AUTO

I took the approach that you should ask GEM if it is there.  The
routine below works for me. Whether it is legal... is not clear.

You need to kill GEM on exit so that TOS (or whoever)
can start it again...


/*
 * This C is compiled by my VAX compiler, it may not compile on another
 * compiler in the world. But I am sure the you will get the drift.
 *
 *
 *	Ensure that VDI is running
 */
#include 		/* replace by your favourite header */

static int vdi_handle;


ensure_vdi()
{	short	work_in[11];
	short	work_out[57];
	register i;
	
	if (vdi_handle == 0)
	{	work_out[0] = 0;
		vq_extnd(1, 0, work_out);
		if (work_out[0] == 0)
		{	/* need to open the workstation */
			for (i = 0; i < 10; i++)
				work_in[i] = 1;
			work_in[10] = 2;
			v_opnwk(work_in, &vdi_handle, work_out);
		}
	}
}

ensure_vdi_closed()
{	if (vdi_handle)
		v_clswk(vdi_handle);
}