/*
	File:		Timer.h

	Copyright:	© 1984-1993 by Apple Computer, Inc., all rights reserved.

	WARNING
	This file was auto generated by the interfacer tool. Modifications
	must be made to the master file.

*/

#ifndef __TIMER__
#define __TIMER__

#ifndef __TYPES__
#include <MacTypes.H>
#endif

#ifndef __OSUTILS__
#include <OSUtils.H>
#endif

#if PRAGMA_IMPORT
#pragma import on
#endif

#if PRAGMA_STRUCT_ALIGN
	#pragma options align=mac68k
#elif PRAGMA_STRUCT_PACKPUSH
	#pragma pack(push, 2)
#elif PRAGMA_STRUCT_PACK
	#pragma pack(2)
#endif

typedef struct TMTask TMTask, *TMTaskPtr;


/*
	TimerProcs cannot be written in or called from a high-level
	language without the help of mixed mode or assembly glue because they
	use the following parameter-passing convention:

	typedef pascal void (*TimerProcPtr)(TMTaskPtr tmTaskPtr);

		In:
			=>	tmTaskPtr			A1.L
		Out:
			none
*/

enum  {
	uppTimerProcInfo			= kRegisterBased|REGISTER_ROUTINE_PARAMETER(1,kRegisterA1,kFourByteCode)
};

#if USESROUTINEDESCRIPTORS
typedef void (pascal *TimerProcPtr)(TMTaskPtr tmTaskPtr);

typedef UniversalProcPtr TimerUPP;

#define CallTimerProc(userRoutine, tmTaskPtr)  \
	CallUniversalProc((UniversalProcPtr)(userRoutine), uppTimerProcInfo, (tmTaskPtr))

#define NewTimerProc(userRoutine)  \
	(TimerUPP) NewRoutineDescriptor((ProcPtr)(userRoutine), uppTimerProcInfo, GetCurrentISA())

#else
typedef ProcPtr TimerUPP;

#define NewTimerProc(userRoutine)  \
	(TimerUPP)(userRoutine)

#endif

#define kTMTaskActive (1<<15)

struct TMTask {
	QElemPtr			qLink;
	short			qType;
	TimerUPP			tmAddr;
	long			tmCount;
	long			tmWakeUp;
	long			tmReserved;
};
#ifdef __cplusplus
extern "C" {
#endif


extern void pascal InsTime(QElemPtr tmTaskPtr);

extern void pascal InsXTime(QElemPtr tmTaskPtr);

extern void pascal PrimeTime(QElemPtr tmTaskPtr, long count);

extern void pascal RmvTime(QElemPtr tmTaskPtr);
extern void pascal Microseconds(UnsignedWide *microTickCount);
#if PRAGMA_STRUCT_ALIGN
	#pragma options align=reset
#elif PRAGMA_STRUCT_PACKPUSH
	#pragma pack(pop)
#elif PRAGMA_STRUCT_PACK
	#pragma pack()
#endif

#ifdef PRAGMA_IMPORT_OFF
#pragma import off
#elif PRAGMA_IMPORT
#pragma import reset
#endif

#ifdef __cplusplus
}
#endif

#endif


