1/* $Copyright: 2 * 3 * Copyright 1998-2000 by the Massachusetts Institute of Technology. 4 * 5 * All rights reserved. 6 * 7 * Permission to use, copy, modify, and distribute this software and its 8 * documentation for any purpose and without fee is hereby granted, 9 * provided that the above copyright notice appear in all copies and that 10 * both that copyright notice and this permission notice appear in 11 * supporting documentation, and that the name of M.I.T. not be used in 12 * advertising or publicity pertaining to distribution of the software 13 * without specific, written prior permission. Furthermore if you modify 14 * this software you must label your software as modified software and not 15 * distribute it in such a fashion that it might be confused with the 16 * original MIT software. M.I.T. makes no representations about the 17 * suitability of this software for any purpose. It is provided "as is" 18 * without express or implied warranty. 19 * 20 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED 21 * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF 22 * MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. 23 * 24 * Individual source code files are copyright MIT, Cygnus Support, 25 * OpenVision, Oracle, Sun Soft, FundsXpress, and others. 26 * 27 * Project Athena, Athena, Athena MUSE, Discuss, Hesiod, Kerberos, Moira, 28 * and Zephyr are trademarks of the Massachusetts Institute of Technology 29 * (MIT). No commercial use of these trademarks may be made without prior 30 * written permission of MIT. 31 * 32 * "Commercial use" means use of a name in a product or other for-profit 33 * manner. It does NOT prevent a commercial firm from referring to the MIT 34 * trademarks in order to convey information (although in doing so, 35 * recognition of their trademark status should be given). 36 * $ 37 */ 38 39/* $Header: /Volumes/backup/dsmigrate/Dumps/../CVS/passwordserver_sasl/cyrus_sasl/mac/CommonKClient/mac_kclient3/Headers/KerberosSupport/Idle.h,v 1.4 2005/01/10 19:10:48 snsimon Exp $ */ 40 41/* 42 * 43 * Idle.h -- Main external header file for the Idle library. 44 * 45 */ 46 47#ifndef _IDLELIB_ 48#define _IDLELIB_ 49 50#include <Events.h> 51 52#ifdef __cplusplus 53extern "C" { 54#endif 55 56#if defined(__CFM68K__) && !defined(__USING_STATIC_LIBS__) 57# pragma import on 58#endif 59 60 61/****************************/ 62/* API Structures and Types */ 63/****************************/ 64 65/* Callback API for Event handler proc for idle loop */ 66typedef CALLBACK_API (Boolean, IdleEventHandlerProcPtr) (const EventRecord *theEvent, UInt32 refCon); 67 68/* UPP for Idle Library event filter */ 69#if !TARGET_API_MAC_CARBON 70 typedef STACK_UPP_TYPE (IdleEventHandlerProcPtr) IdleEventHandlerUPP; 71 72 #define NewIdleEventHandlerProc(userRoutine) \ 73 (IdleEventHandlerUPP) NewRoutineDescriptor((ProcPtr)(userRoutine), uppIdleEventHandlerProcInfo, GetCurrentArchitecture()) 74#else 75 typedef IdleEventHandlerProcPtr IdleEventHandlerUPP; 76 77 #define NewIdleEventHandlerProc(userRoutine) \ 78 userRoutine 79#endif 80 81 82/* Procinfo for Idle Library event filter */ 83enum { 84 uppIdleEventHandlerProcInfo = kPascalStackBased | 85 RESULT_SIZE (sizeof (Boolean)) | 86 STACK_ROUTINE_PARAMETER (1, SIZE_CODE (sizeof (const EventRecord *))) | 87 STACK_ROUTINE_PARAMETER (2, SIZE_CODE (sizeof (UInt32))) 88}; 89 90 91/***********************/ 92/* Function Prototypes */ 93/***********************/ 94 95#define IdleLibIsPresent_ ((Ptr) Idle != (Ptr) kUnresolvedCFragSymbolAddress) 96 97/* IdleLib API calls */ 98OSStatus IdleAddEventHandler(IdleEventHandlerUPP eventHandlerUPP, Boolean isApplication, 99 UInt16 mask, UInt32 refCon); 100OSStatus IdleRemoveEventHandler(IdleEventHandlerUPP eventHandlerUPP); 101 102void IdleSetActive(IdleEventHandlerUPP eventHandlerUPP); 103void IdleSetInactive(IdleEventHandlerUPP eventHandlerUPP); 104 105void IdleSetIdleFrequency(UInt32 idleFrequency); 106UInt32 IdleGetIdleFrequency(void); 107 108void IdleSetEventSleepTime(UInt32 eventSleepTime); 109UInt32 IdleGetEventSleepTime(void); 110 111void IdleSetThreaded(Boolean isThreaded); 112Boolean IdleGetThreaded(void); 113 114void IdleSetShouldIdle(Boolean shouldIdle); 115Boolean IdleGetShouldIdle(void); 116 117Boolean IdleHandleEvent (const EventRecord *theEvent); 118OSStatus Idle(void); 119 120 121#if defined(__CFM68K__) && !defined(__USING_STATIC_LIBS__) 122# pragma import reset 123#endif 124 125#ifdef __cplusplus 126} 127#endif 128 129#endif /* _IDLELIB_ */ 130