//==============================================================================
// KEYQUENCER EXTENSIONS MAIN DISPATCHER - VERSION 1.2.1 - NOVEMBER 1994
// ©1994 Alessandro Levi Montalcini <LMontalcini@pmn.it>
// DonŐt forget to send me any cool extensions you create!
// This text looks best in monaco 9 font, 4 spaces per tab, no wrapping
//
// DOCUMENTATION IS AVAILABLE IN THE EXTENSION.H AND ACTION.H HEADERS

#include "A4Globals.h"
#include "Extension.h"
#include "Action.h"

//==============================================================================
// MAIN ENTRY POINT AND MESSAGE DISPATCHER

pascal short main(long message, ParamsPtr params, MachineHandle mac, GluePtr glue)
{
	long	world;
	short	error;
	
	MAIN_SETUP_GLOBALS(world);
	switch(message)
	{
		case kExtMessageRun:
			error = run(params, mac, glue);
			break;
		case kExtMessageInit:
			error = init(mac, glue);
			break;
	}
	MAIN_RESTORE_GLOBALS(world);
	return error;
}

//==============================================================================
// GLOBAL STORAGE FOR TRAP PATCHES AND CALLBACKS (see Action.h)

long SetupExtensionWorld(void)
{
	long	world;
	
	TEMP_SETUP_GLOBALS(world);
	return world;
}

void RestoreExtensionWorld(long world)
{
	TEMP_RESTORE_GLOBALS(world);
}

//==============================================================================
