Team Fortress 2 Source Code as on 22/4/2020
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

301 lines
8.0 KiB

  1. /*
  2. File: Timer.h
  3. Contains: Time Manager interfaces.
  4. Version: QuickTime 7.3
  5. Copyright: (c) 2007 (c) 1985-2001 by Apple Computer, Inc., all rights reserved
  6. Bugs?: For bug reports, consult the following page on
  7. the World Wide Web:
  8. http://developer.apple.com/bugreporter/
  9. */
  10. #ifndef __TIMER__
  11. #define __TIMER__
  12. #ifndef __CONDITIONALMACROS__
  13. #include <ConditionalMacros.h>
  14. #endif
  15. #ifndef __MACTYPES__
  16. #include <MacTypes.h>
  17. #endif
  18. #ifndef __OSUTILS__
  19. #include <OSUtils.h>
  20. #endif
  21. #if PRAGMA_ONCE
  22. #pragma once
  23. #endif
  24. #ifdef __cplusplus
  25. extern "C" {
  26. #endif
  27. #if PRAGMA_IMPORT
  28. #pragma import on
  29. #endif
  30. #if PRAGMA_STRUCT_ALIGN
  31. #pragma options align=mac68k
  32. #elif PRAGMA_STRUCT_PACKPUSH
  33. #pragma pack(push, 2)
  34. #elif PRAGMA_STRUCT_PACK
  35. #pragma pack(2)
  36. #endif
  37. enum {
  38. /* high bit of qType is set if task is active */
  39. kTMTaskActive = (1L << 15)
  40. };
  41. typedef struct TMTask TMTask;
  42. typedef TMTask * TMTaskPtr;
  43. typedef CALLBACK_API_REGISTER68K( void , TimerProcPtr, (TMTaskPtr tmTaskPtr) );
  44. typedef REGISTER_UPP_TYPE(TimerProcPtr) TimerUPP;
  45. struct TMTask {
  46. QElemPtr qLink;
  47. short qType;
  48. TimerUPP tmAddr;
  49. long tmCount;
  50. long tmWakeUp;
  51. long tmReserved;
  52. };
  53. /*
  54. * InsTime()
  55. *
  56. * Availability:
  57. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  58. * CarbonLib: in CarbonLib 1.0 and later
  59. * Mac OS X: in version 10.0 and later
  60. */
  61. #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  62. #pragma parameter InsTime(__A0)
  63. #endif
  64. EXTERN_API( void )
  65. InsTime(QElemPtr tmTaskPtr) ONEWORDINLINE(0xA058);
  66. /*
  67. * InsXTime()
  68. *
  69. * Availability:
  70. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  71. * CarbonLib: in CarbonLib 1.0 and later
  72. * Mac OS X: in version 10.0 and later
  73. */
  74. #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  75. #pragma parameter InsXTime(__A0)
  76. #endif
  77. EXTERN_API( void )
  78. InsXTime(QElemPtr tmTaskPtr) ONEWORDINLINE(0xA458);
  79. /*
  80. * PrimeTime()
  81. *
  82. * Availability:
  83. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  84. * CarbonLib: in CarbonLib 1.0 and later
  85. * Mac OS X: in version 10.0 and later
  86. */
  87. #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  88. #pragma parameter PrimeTime(__A0, __D0)
  89. #endif
  90. EXTERN_API( void )
  91. PrimeTime(
  92. QElemPtr tmTaskPtr,
  93. long count) ONEWORDINLINE(0xA05A);
  94. /*
  95. * RmvTime()
  96. *
  97. * Availability:
  98. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  99. * CarbonLib: in CarbonLib 1.0 and later
  100. * Mac OS X: in version 10.0 and later
  101. */
  102. #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  103. #pragma parameter RmvTime(__A0)
  104. #endif
  105. EXTERN_API( void )
  106. RmvTime(QElemPtr tmTaskPtr) ONEWORDINLINE(0xA059);
  107. /* InstallTimeTask, InstallXTimeTask, PrimeTimeTask and RemoveTimeTask work */
  108. /* just like InsTime, InsXTime, PrimeTime, and RmvTime except that they */
  109. /* return an OSErr result. */
  110. /*
  111. * InstallTimeTask()
  112. *
  113. * Availability:
  114. * Non-Carbon CFM: in InterfaceLib 9.1 and later
  115. * CarbonLib: in CarbonLib 1.0.2 and later
  116. * Mac OS X: in version 10.0 and later
  117. */
  118. #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  119. #pragma parameter __D0 InstallTimeTask(__A0)
  120. #endif
  121. EXTERN_API( OSErr )
  122. InstallTimeTask(QElemPtr tmTaskPtr) ONEWORDINLINE(0xA058);
  123. /*
  124. * InstallXTimeTask()
  125. *
  126. * Availability:
  127. * Non-Carbon CFM: in InterfaceLib 9.1 and later
  128. * CarbonLib: in CarbonLib 1.0.2 and later
  129. * Mac OS X: in version 10.0 and later
  130. */
  131. #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  132. #pragma parameter __D0 InstallXTimeTask(__A0)
  133. #endif
  134. EXTERN_API( OSErr )
  135. InstallXTimeTask(QElemPtr tmTaskPtr) ONEWORDINLINE(0xA458);
  136. /*
  137. * PrimeTimeTask()
  138. *
  139. * Availability:
  140. * Non-Carbon CFM: in InterfaceLib 9.1 and later
  141. * CarbonLib: in CarbonLib 1.0.2 and later
  142. * Mac OS X: in version 10.0 and later
  143. */
  144. #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  145. #pragma parameter __D0 PrimeTimeTask(__A0, __D0)
  146. #endif
  147. EXTERN_API( OSErr )
  148. PrimeTimeTask(
  149. QElemPtr tmTaskPtr,
  150. long count) ONEWORDINLINE(0xA05A);
  151. /*
  152. * RemoveTimeTask()
  153. *
  154. * Availability:
  155. * Non-Carbon CFM: in InterfaceLib 9.1 and later
  156. * CarbonLib: in CarbonLib 1.0.2 and later
  157. * Mac OS X: in version 10.0 and later
  158. */
  159. #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  160. #pragma parameter __D0 RemoveTimeTask(__A0)
  161. #endif
  162. EXTERN_API( OSErr )
  163. RemoveTimeTask(QElemPtr tmTaskPtr) ONEWORDINLINE(0xA059);
  164. /*
  165. * Microseconds()
  166. *
  167. * Availability:
  168. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  169. * CarbonLib: in CarbonLib 1.0 and later
  170. * Mac OS X: in version 10.0 and later
  171. */
  172. EXTERN_API( void )
  173. Microseconds(UnsignedWide * microTickCount) FOURWORDINLINE(0xA193, 0x225F, 0x22C8, 0x2280);
  174. /*
  175. * NewTimerUPP()
  176. *
  177. * Availability:
  178. * Non-Carbon CFM: available as macro/inline
  179. * CarbonLib: in CarbonLib 1.0 and later
  180. * Mac OS X: in version 10.0 and later
  181. */
  182. EXTERN_API_C( TimerUPP )
  183. NewTimerUPP(TimerProcPtr userRoutine);
  184. #if !OPAQUE_UPP_TYPES
  185. enum { uppTimerProcInfo = 0x0000B802 }; /* register no_return_value Func(4_bytes:A1) */
  186. #ifdef __cplusplus
  187. inline DEFINE_API_C(TimerUPP) NewTimerUPP(TimerProcPtr userRoutine) { return (TimerUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppTimerProcInfo, GetCurrentArchitecture()); }
  188. #else
  189. #define NewTimerUPP(userRoutine) (TimerUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppTimerProcInfo, GetCurrentArchitecture())
  190. #endif
  191. #endif
  192. /*
  193. * DisposeTimerUPP()
  194. *
  195. * Availability:
  196. * Non-Carbon CFM: available as macro/inline
  197. * CarbonLib: in CarbonLib 1.0 and later
  198. * Mac OS X: in version 10.0 and later
  199. */
  200. EXTERN_API_C( void )
  201. DisposeTimerUPP(TimerUPP userUPP);
  202. #if !OPAQUE_UPP_TYPES
  203. #ifdef __cplusplus
  204. inline DEFINE_API_C(void) DisposeTimerUPP(TimerUPP userUPP) { DisposeRoutineDescriptor((UniversalProcPtr)userUPP); }
  205. #else
  206. #define DisposeTimerUPP(userUPP) DisposeRoutineDescriptor(userUPP)
  207. #endif
  208. #endif
  209. /*
  210. * InvokeTimerUPP()
  211. *
  212. * Availability:
  213. * Non-Carbon CFM: available as macro/inline
  214. * CarbonLib: in CarbonLib 1.0 and later
  215. * Mac OS X: in version 10.0 and later
  216. */
  217. #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  218. #pragma parameter InvokeTimerUPP(__A1, __A0)
  219. #endif
  220. EXTERN_API_C( void )
  221. InvokeTimerUPP(
  222. TMTaskPtr tmTaskPtr,
  223. TimerUPP userUPP) ONEWORDINLINE(0x4E90);
  224. #if !OPAQUE_UPP_TYPES && (!TARGET_OS_MAC || !TARGET_CPU_68K || TARGET_RT_MAC_CFM)
  225. #ifdef __cplusplus
  226. inline DEFINE_API_C(void) InvokeTimerUPP(TMTaskPtr tmTaskPtr, TimerUPP userUPP) { CALL_ONE_PARAMETER_UPP(userUPP, uppTimerProcInfo, tmTaskPtr); }
  227. #else
  228. #define InvokeTimerUPP(tmTaskPtr, userUPP) CALL_ONE_PARAMETER_UPP((userUPP), uppTimerProcInfo, (tmTaskPtr))
  229. #endif
  230. #endif
  231. #if CALL_NOT_IN_CARBON || OLDROUTINENAMES
  232. /* support for pre-Carbon UPP routines: New...Proc and Call...Proc */
  233. #define NewTimerProc(userRoutine) NewTimerUPP(userRoutine)
  234. #define CallTimerProc(userRoutine, tmTaskPtr) InvokeTimerUPP(tmTaskPtr, userRoutine)
  235. #endif /* CALL_NOT_IN_CARBON */
  236. #if PRAGMA_STRUCT_ALIGN
  237. #pragma options align=reset
  238. #elif PRAGMA_STRUCT_PACKPUSH
  239. #pragma pack(pop)
  240. #elif PRAGMA_STRUCT_PACK
  241. #pragma pack()
  242. #endif
  243. #ifdef PRAGMA_IMPORT_OFF
  244. #pragma import off
  245. #elif PRAGMA_IMPORT
  246. #pragma import reset
  247. #endif
  248. #ifdef __cplusplus
  249. }
  250. #endif
  251. #endif /* __TIMER__ */