[net.micro.mac] Another TransSkel patch

dubois@uwmacc.UUCP (Paul DuBois) (08/30/86)

Here's a patch to TransSkel that will allow you to take advantage
of the printf window posted to mod.mac recently.  It will also allow
modeless dialogs to be handled in TransSkel applications, something
that was not possible before.  The basic idea is to provide a way
for the host to inspect event records before TransSkel handles them.

Add the following lines somewhere:

static Boolean (*pEvent)() = nil;

SkelEventHook (p)
Boolean	(*p)();
{
	pEvent = p;
}

and in SkelMain, change:

	DoEvent (&theEvent);

to:

	if (pEvent == nil || (*pEvent) (&theEvent) == false)
		DoEvent (&theEvent);


The hook should be declared as follows:

Boolean EventHook (evtPtr)
EventRecord	*evtPtr;

If a hook is installed, any time it returns true, TransSkel will
assume it handled the event and will ignore it.  If the hook returns
false, TransSkel handles the event as usual.

Pass nil to SkelEventHook to de-install event inspection.
-- 
Paul DuBois     UUCP: {allegra,ihnp4,seismo}!uwvax!uwmacc!dubois    |
                ARPA: dubois@easter                               --+--
                                                                    |
Begin at my sanctuary...                                            |
                          Ezekiel 9:6