DASession.pas 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328
  1. {
  2. * Copyright (c) 1998-2009 Apple Inc. All Rights Reserved.
  3. *
  4. * @APPLE_LICENSE_HEADER_START@
  5. *
  6. * This file contains Original Code and/or Modifications of Original Code
  7. * as defined in and that are subject to the Apple Public Source License
  8. * Version 2.0 (the 'License'). You may not use this file except in
  9. * compliance with the License. Please obtain a copy of the License at
  10. * http://www.opensource.apple.com/apsl/ and read it before using this
  11. * file.
  12. *
  13. * The Original Code and all software distributed under the License are
  14. * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
  15. * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
  16. * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
  17. * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
  18. * Please see the License for the specific language governing rights and
  19. * limitations under the License.
  20. *
  21. * @APPLE_LICENSE_HEADER_END@
  22. }
  23. { Initial Pascal Translation: Jonas Maebe, <[email protected]>, October 2009 }
  24. {
  25. Modified for use with Free Pascal
  26. Version 308
  27. Please report any bugs to <[email protected]>
  28. }
  29. {$ifc not defined MACOSALLINCLUDE or not MACOSALLINCLUDE}
  30. {$mode macpas}
  31. {$modeswitch cblocks}
  32. {$packenum 1}
  33. {$macro on}
  34. {$inline on}
  35. {$calling mwpascal}
  36. unit DASession;
  37. interface
  38. {$setc UNIVERSAL_INTERFACES_VERSION := $0400}
  39. {$setc GAP_INTERFACES_VERSION := $0308}
  40. {$ifc not defined USE_CFSTR_CONSTANT_MACROS}
  41. {$setc USE_CFSTR_CONSTANT_MACROS := TRUE}
  42. {$endc}
  43. {$ifc defined CPUPOWERPC and defined CPUI386}
  44. {$error Conflicting initial definitions for CPUPOWERPC and CPUI386}
  45. {$endc}
  46. {$ifc defined FPC_BIG_ENDIAN and defined FPC_LITTLE_ENDIAN}
  47. {$error Conflicting initial definitions for FPC_BIG_ENDIAN and FPC_LITTLE_ENDIAN}
  48. {$endc}
  49. {$ifc not defined __ppc__ and defined CPUPOWERPC32}
  50. {$setc __ppc__ := 1}
  51. {$elsec}
  52. {$setc __ppc__ := 0}
  53. {$endc}
  54. {$ifc not defined __ppc64__ and defined CPUPOWERPC64}
  55. {$setc __ppc64__ := 1}
  56. {$elsec}
  57. {$setc __ppc64__ := 0}
  58. {$endc}
  59. {$ifc not defined __i386__ and defined CPUI386}
  60. {$setc __i386__ := 1}
  61. {$elsec}
  62. {$setc __i386__ := 0}
  63. {$endc}
  64. {$ifc not defined __x86_64__ and defined CPUX86_64}
  65. {$setc __x86_64__ := 1}
  66. {$elsec}
  67. {$setc __x86_64__ := 0}
  68. {$endc}
  69. {$ifc not defined __arm__ and defined CPUARM}
  70. {$setc __arm__ := 1}
  71. {$elsec}
  72. {$setc __arm__ := 0}
  73. {$endc}
  74. {$ifc not defined __arm64__ and defined CPUAARCH64}
  75. {$setc __arm64__ := 1}
  76. {$elsec}
  77. {$setc __arm64__ := 0}
  78. {$endc}
  79. {$ifc defined cpu64}
  80. {$setc __LP64__ := 1}
  81. {$elsec}
  82. {$setc __LP64__ := 0}
  83. {$endc}
  84. {$ifc defined __ppc__ and __ppc__ and defined __i386__ and __i386__}
  85. {$error Conflicting definitions for __ppc__ and __i386__}
  86. {$endc}
  87. {$ifc defined __ppc__ and __ppc__}
  88. {$setc TARGET_CPU_PPC := TRUE}
  89. {$setc TARGET_CPU_PPC64 := FALSE}
  90. {$setc TARGET_CPU_X86 := FALSE}
  91. {$setc TARGET_CPU_X86_64 := FALSE}
  92. {$setc TARGET_CPU_ARM := FALSE}
  93. {$setc TARGET_CPU_ARM64 := FALSE}
  94. {$setc TARGET_OS_MAC := TRUE}
  95. {$setc TARGET_OS_IPHONE := FALSE}
  96. {$setc TARGET_IPHONE_SIMULATOR := FALSE}
  97. {$setc TARGET_OS_EMBEDDED := FALSE}
  98. {$elifc defined __ppc64__ and __ppc64__}
  99. {$setc TARGET_CPU_PPC := FALSE}
  100. {$setc TARGET_CPU_PPC64 := TRUE}
  101. {$setc TARGET_CPU_X86 := FALSE}
  102. {$setc TARGET_CPU_X86_64 := FALSE}
  103. {$setc TARGET_CPU_ARM := FALSE}
  104. {$setc TARGET_CPU_ARM64 := FALSE}
  105. {$setc TARGET_OS_MAC := TRUE}
  106. {$setc TARGET_OS_IPHONE := FALSE}
  107. {$setc TARGET_IPHONE_SIMULATOR := FALSE}
  108. {$setc TARGET_OS_EMBEDDED := FALSE}
  109. {$elifc defined __i386__ and __i386__}
  110. {$setc TARGET_CPU_PPC := FALSE}
  111. {$setc TARGET_CPU_PPC64 := FALSE}
  112. {$setc TARGET_CPU_X86 := TRUE}
  113. {$setc TARGET_CPU_X86_64 := FALSE}
  114. {$setc TARGET_CPU_ARM := FALSE}
  115. {$setc TARGET_CPU_ARM64 := FALSE}
  116. {$ifc defined iphonesim}
  117. {$setc TARGET_OS_MAC := FALSE}
  118. {$setc TARGET_OS_IPHONE := TRUE}
  119. {$setc TARGET_IPHONE_SIMULATOR := TRUE}
  120. {$elsec}
  121. {$setc TARGET_OS_MAC := TRUE}
  122. {$setc TARGET_OS_IPHONE := FALSE}
  123. {$setc TARGET_IPHONE_SIMULATOR := FALSE}
  124. {$endc}
  125. {$setc TARGET_OS_EMBEDDED := FALSE}
  126. {$elifc defined __x86_64__ and __x86_64__}
  127. {$setc TARGET_CPU_PPC := FALSE}
  128. {$setc TARGET_CPU_PPC64 := FALSE}
  129. {$setc TARGET_CPU_X86 := FALSE}
  130. {$setc TARGET_CPU_X86_64 := TRUE}
  131. {$setc TARGET_CPU_ARM := FALSE}
  132. {$setc TARGET_CPU_ARM64 := FALSE}
  133. {$ifc defined iphonesim}
  134. {$setc TARGET_OS_MAC := FALSE}
  135. {$setc TARGET_OS_IPHONE := TRUE}
  136. {$setc TARGET_IPHONE_SIMULATOR := TRUE}
  137. {$elsec}
  138. {$setc TARGET_OS_MAC := TRUE}
  139. {$setc TARGET_OS_IPHONE := FALSE}
  140. {$setc TARGET_IPHONE_SIMULATOR := FALSE}
  141. {$endc}
  142. {$setc TARGET_OS_EMBEDDED := FALSE}
  143. {$elifc defined __arm__ and __arm__}
  144. {$setc TARGET_CPU_PPC := FALSE}
  145. {$setc TARGET_CPU_PPC64 := FALSE}
  146. {$setc TARGET_CPU_X86 := FALSE}
  147. {$setc TARGET_CPU_X86_64 := FALSE}
  148. {$setc TARGET_CPU_ARM := TRUE}
  149. {$setc TARGET_CPU_ARM64 := FALSE}
  150. {$setc TARGET_OS_MAC := FALSE}
  151. {$setc TARGET_OS_IPHONE := TRUE}
  152. {$setc TARGET_IPHONE_SIMULATOR := FALSE}
  153. {$setc TARGET_OS_EMBEDDED := TRUE}
  154. {$elifc defined __arm64__ and __arm64__}
  155. {$setc TARGET_CPU_PPC := FALSE}
  156. {$setc TARGET_CPU_PPC64 := FALSE}
  157. {$setc TARGET_CPU_X86 := FALSE}
  158. {$setc TARGET_CPU_X86_64 := FALSE}
  159. {$setc TARGET_CPU_ARM := FALSE}
  160. {$setc TARGET_CPU_ARM64 := TRUE}
  161. {$ifc defined ios}
  162. {$setc TARGET_OS_MAC := FALSE}
  163. {$setc TARGET_OS_IPHONE := TRUE}
  164. {$setc TARGET_OS_EMBEDDED := TRUE}
  165. {$elsec}
  166. {$setc TARGET_OS_MAC := TRUE}
  167. {$setc TARGET_OS_IPHONE := FALSE}
  168. {$setc TARGET_OS_EMBEDDED := FALSE}
  169. {$endc}
  170. {$setc TARGET_IPHONE_SIMULATOR := FALSE}
  171. {$elsec}
  172. {$error __ppc__ nor __ppc64__ nor __i386__ nor __x86_64__ nor __arm__ nor __arm64__ is defined.}
  173. {$endc}
  174. {$ifc defined __LP64__ and __LP64__ }
  175. {$setc TARGET_CPU_64 := TRUE}
  176. {$elsec}
  177. {$setc TARGET_CPU_64 := FALSE}
  178. {$endc}
  179. {$ifc defined FPC_BIG_ENDIAN}
  180. {$setc TARGET_RT_BIG_ENDIAN := TRUE}
  181. {$setc TARGET_RT_LITTLE_ENDIAN := FALSE}
  182. {$elifc defined FPC_LITTLE_ENDIAN}
  183. {$setc TARGET_RT_BIG_ENDIAN := FALSE}
  184. {$setc TARGET_RT_LITTLE_ENDIAN := TRUE}
  185. {$elsec}
  186. {$error Neither FPC_BIG_ENDIAN nor FPC_LITTLE_ENDIAN are defined.}
  187. {$endc}
  188. {$setc ACCESSOR_CALLS_ARE_FUNCTIONS := TRUE}
  189. {$setc CALL_NOT_IN_CARBON := FALSE}
  190. {$setc OLDROUTINENAMES := FALSE}
  191. {$setc OPAQUE_TOOLBOX_STRUCTS := TRUE}
  192. {$setc OPAQUE_UPP_TYPES := TRUE}
  193. {$setc OTCARBONAPPLICATION := TRUE}
  194. {$setc OTKERNEL := FALSE}
  195. {$setc PM_USE_SESSION_APIS := TRUE}
  196. {$setc TARGET_API_MAC_CARBON := TRUE}
  197. {$setc TARGET_API_MAC_OS8 := FALSE}
  198. {$setc TARGET_API_MAC_OSX := TRUE}
  199. {$setc TARGET_CARBON := TRUE}
  200. {$setc TARGET_CPU_68K := FALSE}
  201. {$setc TARGET_CPU_MIPS := FALSE}
  202. {$setc TARGET_CPU_SPARC := FALSE}
  203. {$setc TARGET_OS_UNIX := FALSE}
  204. {$setc TARGET_OS_WIN32 := FALSE}
  205. {$setc TARGET_RT_MAC_68881 := FALSE}
  206. {$setc TARGET_RT_MAC_CFM := FALSE}
  207. {$setc TARGET_RT_MAC_MACHO := TRUE}
  208. {$setc TYPED_FUNCTION_POINTERS := TRUE}
  209. {$setc TYPE_BOOL := FALSE}
  210. {$setc TYPE_EXTENDED := FALSE}
  211. {$setc TYPE_LONGLONG := TRUE}
  212. uses MacTypes,CFBase,CFRunLoop,CFString;
  213. {$endc} {not MACOSALLINCLUDE}
  214. {$ifc TARGET_OS_MAC}
  215. {$ALIGN POWER}
  216. {!
  217. * @typedef DASessionRef
  218. * Type of a reference to DASession instances.
  219. }
  220. type
  221. DASessionRef = ^SInt32; { an opaque type }
  222. {!
  223. * @function DASessionGetTypeID
  224. * @abstract Returns the type identifier of all DASession instances.
  225. }
  226. function DASessionGetTypeID: CFTypeID; external name '_DASessionGetTypeID';
  227. {!
  228. * @function DASessionCreate
  229. * @abstract Creates a new session.
  230. * @result A reference to a new DASession.
  231. * @discussion
  232. * The caller of this function receives a reference to the returned object. The
  233. * caller also implicitly retains the object and is responsible for releasing it.
  234. }
  235. function DASessionCreate( allocator: CFAllocatorRef ): DASessionRef; external name '_DASessionCreate';
  236. {!
  237. * @function DASessionScheduleWithRunLoop
  238. * @abstract Schedules the session on a run loop.
  239. * @param session The session which is being scheduled.
  240. * @param runLoop The run loop on which the session should be scheduled.
  241. * @param runLoopMode The run loop mode in which the session should be scheduled.
  242. }
  243. procedure DASessionScheduleWithRunLoop( session: DASessionRef; runLoop: CFRunLoopRef; runLoopMode: CFStringRef ); external name '_DASessionScheduleWithRunLoop';
  244. {!
  245. * @function DASessionUnscheduleFromRunLoop
  246. * @abstract Unschedules the session from a run loop.
  247. * @param session The session which is being unscheduled.
  248. * @param runLoop The run loop on which the session is scheduled.
  249. * @param runLoopMode The run loop mode in which the session is scheduled.
  250. }
  251. procedure DASessionUnscheduleFromRunLoop( session: DASessionRef; runLoop: CFRunLoopRef; runLoopMode: CFStringRef ); external name '_DASessionUnscheduleFromRunLoop';
  252. {!
  253. * @typedef DAApprovalSessionRef
  254. * Type of a reference to DAApprovalSession instances.
  255. }
  256. type
  257. DAApprovalSessionRef = ^SInt32; { an opaque type }
  258. {!
  259. * @function DAApprovalSessionGetTypeID
  260. * @abstract Returns the type identifier of all DAApprovalSession instances.
  261. }
  262. function DAApprovalSessionGetTypeID: CFTypeID; external name '_DAApprovalSessionGetTypeID';
  263. {!
  264. * @function DAApprovalSessionCreate
  265. * @abstract Creates a new approval session.
  266. * @result A reference to a new DAApprovalSession.
  267. * @discussion
  268. * The caller of this function receives a reference to the returned object. The
  269. * caller also implicitly retains the object and is responsible for releasing it.
  270. }
  271. function DAApprovalSessionCreate( allocator: CFAllocatorRef ): DAApprovalSessionRef; external name '_DAApprovalSessionCreate';
  272. {!
  273. * @function DAApprovalSessionScheduleWithRunLoop
  274. * @abstract Schedules the approval session on a run loop.
  275. * @param session The approval session which is being scheduled.
  276. * @param runLoop The run loop on which the approval session should be scheduled.
  277. * @param runLoopMode The run loop mode in which the approval session should be scheduled.
  278. }
  279. procedure DAApprovalSessionScheduleWithRunLoop( session: DAApprovalSessionRef; runLoop: CFRunLoopRef; runLoopMode: CFStringRef ); external name '_DAApprovalSessionScheduleWithRunLoop';
  280. {!
  281. * @function DAApprovalSessionUnscheduleFromRunLoop
  282. * @abstract Unschedules the approval session from a run loop.
  283. * @param session The approval session which is being unscheduled.
  284. * @param runLoop The run loop on which the approval session is scheduled.
  285. * @param runLoopMode The run loop mode in which the approval session is scheduled.
  286. }
  287. procedure DAApprovalSessionUnscheduleFromRunLoop( session: DAApprovalSessionRef; runLoop: CFRunLoopRef; runLoopMode: CFStringRef ); external name '_DAApprovalSessionUnscheduleFromRunLoop';
  288. {$endc} {TARGET_OS_MAC}
  289. {$ifc not defined MACOSALLINCLUDE or not MACOSALLINCLUDE}
  290. end.
  291. {$endc} {not MACOSALLINCLUDE}