/* 
Copyright (c) 1991-2000 UserLand Software, Inc. 

Permission is hereby granted, free of charge, to any person obtaining a 
copy of this software and associated documentation files (the 
"Software"), to deal in the Software without restriction, including 
without limitation the rights to use, copy, modify, merge, publish, 
distribute, sublicense, and/or sell copies of the Software, and to 
permit persons to whom the Software is furnished to do so, subject to the 
following conditions: 

The above copyright notice and this permission notice shall be 
included in all copies or substantial portions of the Software. 

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 
*/ 


#include "iacinternal.h"


/*
8/24/92 DW: This is the only system event verb that UCMDs need as of Frontier
SDK 2.0. We included this in a separate file so that UCMDs don't have to have all
the overhead of all the routines in iacsysevents.c.
*/


Boolean IACnewsystemverb (OSType vclass, OSType vtoken, AppleEvent *event) {

	/*
	6/29/92 DW: special entry point for messages sent to system event handlers.
	
	implementation detail: this is accomplished by sending the message to ourself.
	*/
	
	AEAddressDesc adr; 
	OSErr ec;
	
	ProcessSerialNumber psn;

	psn.highLongOfPSN = 0;

	psn.lowLongOfPSN = kCurrentProcess;

	AECreateDesc (typeProcessSerialNumber, (Ptr) &psn, sizeof (psn), &adr);
	
	ec = AECreateAppleEvent (
		
		vclass, vtoken, &adr, kAutoGenerateReturnID, kAnyTransactionID, event);
	
	AEDisposeDesc (&adr);

	IACglobals.errorcode = ec;
	
	return (ec == noErr);
	} /*IACnewsystemverb*/