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.

1324 lines
46 KiB

  1. /*
  2. File: AEDataModel.h
  3. Contains: AppleEvent Data Model Interfaces.
  4. Version: QuickTime 7.3
  5. Copyright: (c) 2007 (c) 1996-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 __AEDATAMODEL__
  11. #define __AEDATAMODEL__
  12. #ifndef __MACTYPES__
  13. #include <MacTypes.h>
  14. #endif
  15. #ifndef __MIXEDMODE__
  16. #include <MixedMode.h>
  17. #endif
  18. #if PRAGMA_ONCE
  19. #pragma once
  20. #endif
  21. #ifdef __cplusplus
  22. extern "C" {
  23. #endif
  24. #if PRAGMA_IMPORT
  25. #pragma import on
  26. #endif
  27. #if PRAGMA_STRUCT_ALIGN
  28. #pragma options align=mac68k
  29. #elif PRAGMA_STRUCT_PACKPUSH
  30. #pragma pack(push, 2)
  31. #elif PRAGMA_STRUCT_PACK
  32. #pragma pack(2)
  33. #endif
  34. /* Apple event descriptor types */
  35. enum {
  36. typeBoolean = FOUR_CHAR_CODE('bool'),
  37. typeChar = FOUR_CHAR_CODE('TEXT')
  38. };
  39. /* Preferred numeric Apple event descriptor types */
  40. enum {
  41. typeSInt16 = FOUR_CHAR_CODE('shor'),
  42. typeSInt32 = FOUR_CHAR_CODE('long'),
  43. typeUInt32 = FOUR_CHAR_CODE('magn'),
  44. typeSInt64 = FOUR_CHAR_CODE('comp'),
  45. typeIEEE32BitFloatingPoint = FOUR_CHAR_CODE('sing'),
  46. typeIEEE64BitFloatingPoint = FOUR_CHAR_CODE('doub'),
  47. type128BitFloatingPoint = FOUR_CHAR_CODE('ldbl'),
  48. typeDecimalStruct = FOUR_CHAR_CODE('decm')
  49. };
  50. /* Non-preferred Apple event descriptor types */
  51. enum {
  52. typeSMInt = typeSInt16,
  53. typeShortInteger = typeSInt16,
  54. typeInteger = typeSInt32,
  55. typeLongInteger = typeSInt32,
  56. typeMagnitude = typeUInt32,
  57. typeComp = typeSInt64,
  58. typeSMFloat = typeIEEE32BitFloatingPoint,
  59. typeShortFloat = typeIEEE32BitFloatingPoint,
  60. typeFloat = typeIEEE64BitFloatingPoint,
  61. typeLongFloat = typeIEEE64BitFloatingPoint,
  62. typeExtended = FOUR_CHAR_CODE('exte')
  63. };
  64. /* More Apple event descriptor types */
  65. enum {
  66. typeAEList = FOUR_CHAR_CODE('list'),
  67. typeAERecord = FOUR_CHAR_CODE('reco'),
  68. typeAppleEvent = FOUR_CHAR_CODE('aevt'),
  69. typeEventRecord = FOUR_CHAR_CODE('evrc'),
  70. typeTrue = FOUR_CHAR_CODE('true'),
  71. typeFalse = FOUR_CHAR_CODE('fals'),
  72. typeAlias = FOUR_CHAR_CODE('alis'),
  73. typeEnumerated = FOUR_CHAR_CODE('enum'),
  74. typeType = FOUR_CHAR_CODE('type'),
  75. typeAppParameters = FOUR_CHAR_CODE('appa'),
  76. typeProperty = FOUR_CHAR_CODE('prop'),
  77. typeFSS = FOUR_CHAR_CODE('fss '),
  78. typeFSRef = FOUR_CHAR_CODE('fsrf'),
  79. typeFileURL = FOUR_CHAR_CODE('furl'),
  80. typeKeyword = FOUR_CHAR_CODE('keyw'),
  81. typeSectionH = FOUR_CHAR_CODE('sect'),
  82. typeWildCard = FOUR_CHAR_CODE('****'),
  83. typeApplSignature = FOUR_CHAR_CODE('sign'),
  84. typeQDRectangle = FOUR_CHAR_CODE('qdrt'),
  85. typeFixed = FOUR_CHAR_CODE('fixd'),
  86. typeProcessSerialNumber = FOUR_CHAR_CODE('psn '),
  87. typeApplicationURL = FOUR_CHAR_CODE('aprl'),
  88. typeNull = FOUR_CHAR_CODE('null') /* null or nonexistent data */
  89. };
  90. #if CALL_NOT_IN_CARBON
  91. /* Deprecated addressing modes under Carbon */
  92. enum {
  93. typeSessionID = FOUR_CHAR_CODE('ssid'),
  94. typeTargetID = FOUR_CHAR_CODE('targ'),
  95. typeDispatcherID = FOUR_CHAR_CODE('dspt')
  96. };
  97. #endif /* CALL_NOT_IN_CARBON */
  98. /* Keywords for Apple event attributes */
  99. enum {
  100. keyTransactionIDAttr = FOUR_CHAR_CODE('tran'),
  101. keyReturnIDAttr = FOUR_CHAR_CODE('rtid'),
  102. keyEventClassAttr = FOUR_CHAR_CODE('evcl'),
  103. keyEventIDAttr = FOUR_CHAR_CODE('evid'),
  104. keyAddressAttr = FOUR_CHAR_CODE('addr'),
  105. keyOptionalKeywordAttr = FOUR_CHAR_CODE('optk'),
  106. keyTimeoutAttr = FOUR_CHAR_CODE('timo'),
  107. keyInteractLevelAttr = FOUR_CHAR_CODE('inte'), /* this attribute is read only - will be set in AESend */
  108. keyEventSourceAttr = FOUR_CHAR_CODE('esrc'), /* this attribute is read only - returned as typeShortInteger */
  109. keyMissedKeywordAttr = FOUR_CHAR_CODE('miss'), /* this attribute is read only */
  110. keyOriginalAddressAttr = FOUR_CHAR_CODE('from'), /* new in 1.0.1 */
  111. keyAcceptTimeoutAttr = FOUR_CHAR_CODE('actm') /* new for Mac OS X */
  112. };
  113. /* Constants used for specifying the factoring of AEDescLists. */
  114. enum {
  115. kAEDescListFactorNone = 0,
  116. kAEDescListFactorType = 4,
  117. kAEDescListFactorTypeAndSize = 8
  118. };
  119. /* Constants used creating an AppleEvent */
  120. enum {
  121. /* Constant for the returnID param of AECreateAppleEvent */
  122. kAutoGenerateReturnID = -1, /* AECreateAppleEvent will generate a session-unique ID */
  123. /* Constant for transaction ID's */
  124. kAnyTransactionID = 0 /* no transaction is in use */
  125. };
  126. /* Apple event manager data types */
  127. typedef ResType DescType;
  128. typedef FourCharCode AEKeyword;
  129. #if OPAQUE_TOOLBOX_STRUCTS
  130. typedef struct OpaqueAEDataStorageType* AEDataStorageType;
  131. #else
  132. typedef Ptr AEDataStorageType;
  133. #endif /* OPAQUE_TOOLBOX_STRUCTS */
  134. typedef AEDataStorageType * AEDataStorage;
  135. struct AEDesc {
  136. DescType descriptorType;
  137. AEDataStorage dataHandle;
  138. };
  139. typedef struct AEDesc AEDesc;
  140. typedef AEDesc * AEDescPtr;
  141. struct AEKeyDesc {
  142. AEKeyword descKey;
  143. AEDesc descContent;
  144. };
  145. typedef struct AEKeyDesc AEKeyDesc;
  146. /* a list of AEDesc's is a special kind of AEDesc */
  147. typedef AEDesc AEDescList;
  148. /* AERecord is a list of keyworded AEDesc's */
  149. typedef AEDescList AERecord;
  150. /* an AEDesc which contains address data */
  151. typedef AEDesc AEAddressDesc;
  152. /* an AERecord that contains an AppleEvent, and related data types */
  153. typedef AERecord AppleEvent;
  154. typedef AppleEvent * AppleEventPtr;
  155. typedef SInt16 AEReturnID;
  156. typedef SInt32 AETransactionID;
  157. typedef FourCharCode AEEventClass;
  158. typedef FourCharCode AEEventID;
  159. typedef SInt8 AEArrayType;
  160. enum {
  161. kAEDataArray = 0,
  162. kAEPackedArray = 1,
  163. kAEDescArray = 3,
  164. kAEKeyDescArray = 4
  165. };
  166. enum {
  167. kAEHandleArray = 2
  168. };
  169. union AEArrayData {
  170. short kAEDataArray[1];
  171. char kAEPackedArray[1];
  172. Handle kAEHandleArray[1];
  173. AEDesc kAEDescArray[1];
  174. AEKeyDesc kAEKeyDescArray[1];
  175. };
  176. typedef union AEArrayData AEArrayData;
  177. typedef AEArrayData * AEArrayDataPointer;
  178. /**************************************************************************
  179. These constants are used by AEMach and AEInteraction APIs. They are not
  180. strictly part of the data format, but are declared here due to layering.
  181. **************************************************************************/
  182. typedef SInt16 AESendPriority;
  183. enum {
  184. kAENormalPriority = 0x00000000, /* post message at the end of the event queue */
  185. kAEHighPriority = 0x00000001 /* post message at the front of the event queue (same as nAttnMsg) */
  186. };
  187. typedef SInt32 AESendMode;
  188. enum {
  189. kAENoReply = 0x00000001, /* sender doesn't want a reply to event */
  190. kAEQueueReply = 0x00000002, /* sender wants a reply but won't wait */
  191. kAEWaitReply = 0x00000003, /* sender wants a reply and will wait */
  192. kAEDontReconnect = 0x00000080, /* don't reconnect if there is a sessClosedErr from PPCToolbox */
  193. kAEWantReceipt = 0x00000200, /* (nReturnReceipt) sender wants a receipt of message */
  194. kAENeverInteract = 0x00000010, /* server should not interact with user */
  195. kAECanInteract = 0x00000020, /* server may try to interact with user */
  196. kAEAlwaysInteract = 0x00000030, /* server should always interact with user where appropriate */
  197. kAECanSwitchLayer = 0x00000040, /* interaction may switch layer */
  198. kAEDontRecord = 0x00001000, /* don't record this event - available only in vers 1.0.1 and greater */
  199. kAEDontExecute = 0x00002000, /* don't send the event for recording - available only in vers 1.0.1 and greater */
  200. kAEProcessNonReplyEvents = 0x00008000 /* allow processing of non-reply events while awaiting synchronous AppleEvent reply */
  201. };
  202. /* Constants for timeout durations */
  203. enum {
  204. kAEDefaultTimeout = -1, /* timeout value determined by AEM */
  205. kNoTimeOut = -2 /* wait until reply comes back, however long it takes */
  206. };
  207. /**************************************************************************
  208. These calls are used to set up and modify the coercion dispatch table.
  209. **************************************************************************/
  210. typedef CALLBACK_API( OSErr , AECoerceDescProcPtr )(const AEDesc *fromDesc, DescType toType, long handlerRefcon, AEDesc *toDesc);
  211. typedef CALLBACK_API( OSErr , AECoercePtrProcPtr )(DescType typeCode, const void *dataPtr, Size dataSize, DescType toType, long handlerRefcon, AEDesc *result);
  212. typedef STACK_UPP_TYPE(AECoerceDescProcPtr) AECoerceDescUPP;
  213. typedef STACK_UPP_TYPE(AECoercePtrProcPtr) AECoercePtrUPP;
  214. /*
  215. * NewAECoerceDescUPP()
  216. *
  217. * Availability:
  218. * Non-Carbon CFM: available as macro/inline
  219. * CarbonLib: in CarbonLib 1.0 and later
  220. * Mac OS X: in version 10.0 and later
  221. */
  222. EXTERN_API_C( AECoerceDescUPP )
  223. NewAECoerceDescUPP(AECoerceDescProcPtr userRoutine);
  224. #if !OPAQUE_UPP_TYPES
  225. enum { uppAECoerceDescProcInfo = 0x00003FE0 }; /* pascal 2_bytes Func(4_bytes, 4_bytes, 4_bytes, 4_bytes) */
  226. #ifdef __cplusplus
  227. inline DEFINE_API_C(AECoerceDescUPP) NewAECoerceDescUPP(AECoerceDescProcPtr userRoutine) { return (AECoerceDescUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppAECoerceDescProcInfo, GetCurrentArchitecture()); }
  228. #else
  229. #define NewAECoerceDescUPP(userRoutine) (AECoerceDescUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppAECoerceDescProcInfo, GetCurrentArchitecture())
  230. #endif
  231. #endif
  232. /*
  233. * NewAECoercePtrUPP()
  234. *
  235. * Availability:
  236. * Non-Carbon CFM: available as macro/inline
  237. * CarbonLib: in CarbonLib 1.0 and later
  238. * Mac OS X: in version 10.0 and later
  239. */
  240. EXTERN_API_C( AECoercePtrUPP )
  241. NewAECoercePtrUPP(AECoercePtrProcPtr userRoutine);
  242. #if !OPAQUE_UPP_TYPES
  243. enum { uppAECoercePtrProcInfo = 0x0003FFE0 }; /* pascal 2_bytes Func(4_bytes, 4_bytes, 4_bytes, 4_bytes, 4_bytes, 4_bytes) */
  244. #ifdef __cplusplus
  245. inline DEFINE_API_C(AECoercePtrUPP) NewAECoercePtrUPP(AECoercePtrProcPtr userRoutine) { return (AECoercePtrUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppAECoercePtrProcInfo, GetCurrentArchitecture()); }
  246. #else
  247. #define NewAECoercePtrUPP(userRoutine) (AECoercePtrUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppAECoercePtrProcInfo, GetCurrentArchitecture())
  248. #endif
  249. #endif
  250. /*
  251. * DisposeAECoerceDescUPP()
  252. *
  253. * Availability:
  254. * Non-Carbon CFM: available as macro/inline
  255. * CarbonLib: in CarbonLib 1.0 and later
  256. * Mac OS X: in version 10.0 and later
  257. */
  258. EXTERN_API_C( void )
  259. DisposeAECoerceDescUPP(AECoerceDescUPP userUPP);
  260. #if !OPAQUE_UPP_TYPES
  261. #ifdef __cplusplus
  262. inline DEFINE_API_C(void) DisposeAECoerceDescUPP(AECoerceDescUPP userUPP) { DisposeRoutineDescriptor((UniversalProcPtr)userUPP); }
  263. #else
  264. #define DisposeAECoerceDescUPP(userUPP) DisposeRoutineDescriptor(userUPP)
  265. #endif
  266. #endif
  267. /*
  268. * DisposeAECoercePtrUPP()
  269. *
  270. * Availability:
  271. * Non-Carbon CFM: available as macro/inline
  272. * CarbonLib: in CarbonLib 1.0 and later
  273. * Mac OS X: in version 10.0 and later
  274. */
  275. EXTERN_API_C( void )
  276. DisposeAECoercePtrUPP(AECoercePtrUPP userUPP);
  277. #if !OPAQUE_UPP_TYPES
  278. #ifdef __cplusplus
  279. inline DEFINE_API_C(void) DisposeAECoercePtrUPP(AECoercePtrUPP userUPP) { DisposeRoutineDescriptor((UniversalProcPtr)userUPP); }
  280. #else
  281. #define DisposeAECoercePtrUPP(userUPP) DisposeRoutineDescriptor(userUPP)
  282. #endif
  283. #endif
  284. /*
  285. * InvokeAECoerceDescUPP()
  286. *
  287. * Availability:
  288. * Non-Carbon CFM: available as macro/inline
  289. * CarbonLib: in CarbonLib 1.0 and later
  290. * Mac OS X: in version 10.0 and later
  291. */
  292. EXTERN_API_C( OSErr )
  293. InvokeAECoerceDescUPP(
  294. const AEDesc * fromDesc,
  295. DescType toType,
  296. long handlerRefcon,
  297. AEDesc * toDesc,
  298. AECoerceDescUPP userUPP);
  299. #if !OPAQUE_UPP_TYPES
  300. #ifdef __cplusplus
  301. inline DEFINE_API_C(OSErr) InvokeAECoerceDescUPP(const AEDesc * fromDesc, DescType toType, long handlerRefcon, AEDesc * toDesc, AECoerceDescUPP userUPP) { return (OSErr)CALL_FOUR_PARAMETER_UPP(userUPP, uppAECoerceDescProcInfo, fromDesc, toType, handlerRefcon, toDesc); }
  302. #else
  303. #define InvokeAECoerceDescUPP(fromDesc, toType, handlerRefcon, toDesc, userUPP) (OSErr)CALL_FOUR_PARAMETER_UPP((userUPP), uppAECoerceDescProcInfo, (fromDesc), (toType), (handlerRefcon), (toDesc))
  304. #endif
  305. #endif
  306. /*
  307. * InvokeAECoercePtrUPP()
  308. *
  309. * Availability:
  310. * Non-Carbon CFM: available as macro/inline
  311. * CarbonLib: in CarbonLib 1.0 and later
  312. * Mac OS X: in version 10.0 and later
  313. */
  314. EXTERN_API_C( OSErr )
  315. InvokeAECoercePtrUPP(
  316. DescType typeCode,
  317. const void * dataPtr,
  318. Size dataSize,
  319. DescType toType,
  320. long handlerRefcon,
  321. AEDesc * result,
  322. AECoercePtrUPP userUPP);
  323. #if !OPAQUE_UPP_TYPES
  324. #ifdef __cplusplus
  325. inline DEFINE_API_C(OSErr) InvokeAECoercePtrUPP(DescType typeCode, const void * dataPtr, Size dataSize, DescType toType, long handlerRefcon, AEDesc * result, AECoercePtrUPP userUPP) { return (OSErr)CALL_SIX_PARAMETER_UPP(userUPP, uppAECoercePtrProcInfo, typeCode, dataPtr, dataSize, toType, handlerRefcon, result); }
  326. #else
  327. #define InvokeAECoercePtrUPP(typeCode, dataPtr, dataSize, toType, handlerRefcon, result, userUPP) (OSErr)CALL_SIX_PARAMETER_UPP((userUPP), uppAECoercePtrProcInfo, (typeCode), (dataPtr), (dataSize), (toType), (handlerRefcon), (result))
  328. #endif
  329. #endif
  330. #if CALL_NOT_IN_CARBON || OLDROUTINENAMES
  331. /* support for pre-Carbon UPP routines: New...Proc and Call...Proc */
  332. #define NewAECoerceDescProc(userRoutine) NewAECoerceDescUPP(userRoutine)
  333. #define NewAECoercePtrProc(userRoutine) NewAECoercePtrUPP(userRoutine)
  334. #define CallAECoerceDescProc(userRoutine, fromDesc, toType, handlerRefcon, toDesc) InvokeAECoerceDescUPP(fromDesc, toType, handlerRefcon, toDesc, userRoutine)
  335. #define CallAECoercePtrProc(userRoutine, typeCode, dataPtr, dataSize, toType, handlerRefcon, result) InvokeAECoercePtrUPP(typeCode, dataPtr, dataSize, toType, handlerRefcon, result, userRoutine)
  336. #endif /* CALL_NOT_IN_CARBON */
  337. /* a AECoercionHandlerUPP is by default a AECoerceDescUPP. If you are registering a
  338. Ptr based coercion handler you will have to add a cast to AECoerceDescUPP from
  339. your AECoercePtrUPP type. A future release of the interfaces will fix this by
  340. introducing seperate Desc and Ptr coercion handler installation/remove/query routines. */
  341. typedef AECoerceDescUPP AECoercionHandlerUPP;
  342. /*
  343. * AEInstallCoercionHandler()
  344. *
  345. * Availability:
  346. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  347. * CarbonLib: in CarbonLib 1.0 and later
  348. * Mac OS X: in version 10.0 and later
  349. */
  350. EXTERN_API( OSErr )
  351. AEInstallCoercionHandler(
  352. DescType fromType,
  353. DescType toType,
  354. AECoercionHandlerUPP handler,
  355. long handlerRefcon,
  356. Boolean fromTypeIsDesc,
  357. Boolean isSysHandler) THREEWORDINLINE(0x303C, 0x0A22, 0xA816);
  358. /*
  359. * AERemoveCoercionHandler()
  360. *
  361. * Availability:
  362. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  363. * CarbonLib: in CarbonLib 1.0 and later
  364. * Mac OS X: in version 10.0 and later
  365. */
  366. EXTERN_API( OSErr )
  367. AERemoveCoercionHandler(
  368. DescType fromType,
  369. DescType toType,
  370. AECoercionHandlerUPP handler,
  371. Boolean isSysHandler) THREEWORDINLINE(0x303C, 0x0723, 0xA816);
  372. /*
  373. * AEGetCoercionHandler()
  374. *
  375. * Availability:
  376. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  377. * CarbonLib: in CarbonLib 1.0 and later
  378. * Mac OS X: in version 10.0 and later
  379. */
  380. EXTERN_API( OSErr )
  381. AEGetCoercionHandler(
  382. DescType fromType,
  383. DescType toType,
  384. AECoercionHandlerUPP * handler,
  385. long * handlerRefcon,
  386. Boolean * fromTypeIsDesc,
  387. Boolean isSysHandler) THREEWORDINLINE(0x303C, 0x0B24, 0xA816);
  388. /**************************************************************************
  389. The following calls provide for a coercion interface.
  390. **************************************************************************/
  391. /*
  392. * AECoercePtr()
  393. *
  394. * Availability:
  395. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  396. * CarbonLib: in CarbonLib 1.0 and later
  397. * Mac OS X: in version 10.0 and later
  398. */
  399. EXTERN_API( OSErr )
  400. AECoercePtr(
  401. DescType typeCode,
  402. const void * dataPtr,
  403. Size dataSize,
  404. DescType toType,
  405. AEDesc * result) THREEWORDINLINE(0x303C, 0x0A02, 0xA816);
  406. /*
  407. * AECoerceDesc()
  408. *
  409. * Availability:
  410. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  411. * CarbonLib: in CarbonLib 1.0 and later
  412. * Mac OS X: in version 10.0 and later
  413. */
  414. EXTERN_API( OSErr )
  415. AECoerceDesc(
  416. const AEDesc * theAEDesc,
  417. DescType toType,
  418. AEDesc * result) THREEWORDINLINE(0x303C, 0x0603, 0xA816);
  419. /**************************************************************************
  420. The following calls apply to any AEDesc. Every 'result' descriptor is
  421. created for you, so you will be responsible for memory management
  422. (including disposing) of the descriptors so created.
  423. **************************************************************************/
  424. /* because AEDescs are opaque under Carbon, this AEInitializeDesc provides a
  425. 'clean' way of initializating them to be empty. */
  426. /*
  427. * AEInitializeDesc()
  428. *
  429. * Availability:
  430. * Non-Carbon CFM: not available
  431. * CarbonLib: in CarbonLib 1.4 and later
  432. * Mac OS X: in version 10.0 and later
  433. */
  434. EXTERN_API_C( void )
  435. AEInitializeDesc(AEDesc * desc);
  436. #ifdef __cplusplus
  437. inline void AEInitializeDescInline(AEDesc* d) { d->descriptorType = typeNull; d->dataHandle = NULL; };
  438. #else
  439. #define AEInitializeDescInline(__d) do { AEDesc* d = __d; d->descriptorType = typeNull; d->dataHandle = NULL; } while (0)
  440. #endif
  441. /*
  442. * AECreateDesc()
  443. *
  444. * Availability:
  445. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  446. * CarbonLib: in CarbonLib 1.0 and later
  447. * Mac OS X: in version 10.0 and later
  448. */
  449. EXTERN_API( OSErr )
  450. AECreateDesc(
  451. DescType typeCode,
  452. const void * dataPtr,
  453. Size dataSize,
  454. AEDesc * result) THREEWORDINLINE(0x303C, 0x0825, 0xA816);
  455. /*
  456. * AEDisposeDesc()
  457. *
  458. * Availability:
  459. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  460. * CarbonLib: in CarbonLib 1.0 and later
  461. * Mac OS X: in version 10.0 and later
  462. */
  463. EXTERN_API( OSErr )
  464. AEDisposeDesc(AEDesc * theAEDesc) THREEWORDINLINE(0x303C, 0x0204, 0xA816);
  465. /*
  466. * AEDuplicateDesc()
  467. *
  468. * Availability:
  469. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  470. * CarbonLib: in CarbonLib 1.0 and later
  471. * Mac OS X: in version 10.0 and later
  472. */
  473. EXTERN_API( OSErr )
  474. AEDuplicateDesc(
  475. const AEDesc * theAEDesc,
  476. AEDesc * result) THREEWORDINLINE(0x303C, 0x0405, 0xA816);
  477. /*
  478. * Create an AEDesc with memory "borrowed" from the application. The
  479. * data passed in *must* be immutable and not freed until the Dispose
  480. * callback is made.
  481. * The dispose callback may be made at any time, including during the
  482. * creation of the descriptor.
  483. * If possible, the descriptor will be copied to the address space of
  484. * any recipient process using virtual memory APIs and avoid an
  485. * actual memory copy.
  486. */
  487. typedef CALLBACK_API( void , AEDisposeExternalProcPtr )(const void *dataPtr, Size dataLength, long refcon);
  488. typedef STACK_UPP_TYPE(AEDisposeExternalProcPtr) AEDisposeExternalUPP;
  489. /*
  490. * AECreateDescFromExternalPtr()
  491. *
  492. * Availability:
  493. * Non-Carbon CFM: not available
  494. * CarbonLib: not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
  495. * Mac OS X: in version 10.2 and later
  496. */
  497. EXTERN_API_C( OSStatus )
  498. AECreateDescFromExternalPtr(
  499. OSType descriptorType,
  500. const void * dataPtr,
  501. Size dataLength,
  502. AEDisposeExternalUPP disposeCallback,
  503. long disposeRefcon,
  504. AEDesc * theDesc);
  505. /**************************************************************************
  506. The following calls apply to AEDescList. Since AEDescList is a subtype of
  507. AEDesc, the calls in the previous section can also be used for AEDescList.
  508. All list and array indices are 1-based. If the data was greater than
  509. maximumSize in the routines below, then actualSize will be greater than
  510. maximumSize, but only maximumSize bytes will actually be retrieved.
  511. **************************************************************************/
  512. /*
  513. * AECreateList()
  514. *
  515. * Availability:
  516. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  517. * CarbonLib: in CarbonLib 1.0 and later
  518. * Mac OS X: in version 10.0 and later
  519. */
  520. EXTERN_API( OSErr )
  521. AECreateList(
  522. const void * factoringPtr,
  523. Size factoredSize,
  524. Boolean isRecord,
  525. AEDescList * resultList) THREEWORDINLINE(0x303C, 0x0706, 0xA816);
  526. /*
  527. * AECountItems()
  528. *
  529. * Availability:
  530. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  531. * CarbonLib: in CarbonLib 1.0 and later
  532. * Mac OS X: in version 10.0 and later
  533. */
  534. EXTERN_API( OSErr )
  535. AECountItems(
  536. const AEDescList * theAEDescList,
  537. long * theCount) THREEWORDINLINE(0x303C, 0x0407, 0xA816);
  538. /*
  539. * AEPutPtr()
  540. *
  541. * Availability:
  542. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  543. * CarbonLib: in CarbonLib 1.0 and later
  544. * Mac OS X: in version 10.0 and later
  545. */
  546. EXTERN_API( OSErr )
  547. AEPutPtr(
  548. AEDescList * theAEDescList,
  549. long index,
  550. DescType typeCode,
  551. const void * dataPtr,
  552. Size dataSize) THREEWORDINLINE(0x303C, 0x0A08, 0xA816);
  553. /*
  554. * AEPutDesc()
  555. *
  556. * Availability:
  557. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  558. * CarbonLib: in CarbonLib 1.0 and later
  559. * Mac OS X: in version 10.0 and later
  560. */
  561. EXTERN_API( OSErr )
  562. AEPutDesc(
  563. AEDescList * theAEDescList,
  564. long index,
  565. const AEDesc * theAEDesc) THREEWORDINLINE(0x303C, 0x0609, 0xA816);
  566. /*
  567. * AEGetNthPtr()
  568. *
  569. * Availability:
  570. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  571. * CarbonLib: in CarbonLib 1.0 and later
  572. * Mac OS X: in version 10.0 and later
  573. */
  574. EXTERN_API( OSErr )
  575. AEGetNthPtr(
  576. const AEDescList * theAEDescList,
  577. long index,
  578. DescType desiredType,
  579. AEKeyword * theAEKeyword,
  580. DescType * typeCode,
  581. void * dataPtr,
  582. Size maximumSize,
  583. Size * actualSize) THREEWORDINLINE(0x303C, 0x100A, 0xA816);
  584. /*
  585. * AEGetNthDesc()
  586. *
  587. * Availability:
  588. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  589. * CarbonLib: in CarbonLib 1.0 and later
  590. * Mac OS X: in version 10.0 and later
  591. */
  592. EXTERN_API( OSErr )
  593. AEGetNthDesc(
  594. const AEDescList * theAEDescList,
  595. long index,
  596. DescType desiredType,
  597. AEKeyword * theAEKeyword,
  598. AEDesc * result) THREEWORDINLINE(0x303C, 0x0A0B, 0xA816);
  599. /*
  600. * AESizeOfNthItem()
  601. *
  602. * Availability:
  603. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  604. * CarbonLib: in CarbonLib 1.0 and later
  605. * Mac OS X: in version 10.0 and later
  606. */
  607. EXTERN_API( OSErr )
  608. AESizeOfNthItem(
  609. const AEDescList * theAEDescList,
  610. long index,
  611. DescType * typeCode,
  612. Size * dataSize) THREEWORDINLINE(0x303C, 0x082A, 0xA816);
  613. /*
  614. * AEGetArray()
  615. *
  616. * Availability:
  617. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  618. * CarbonLib: in CarbonLib 1.0 and later
  619. * Mac OS X: in version 10.0 and later
  620. */
  621. EXTERN_API( OSErr )
  622. AEGetArray(
  623. const AEDescList * theAEDescList,
  624. AEArrayType arrayType,
  625. AEArrayDataPointer arrayPtr,
  626. Size maximumSize,
  627. DescType * itemType,
  628. Size * itemSize,
  629. long * itemCount) THREEWORDINLINE(0x303C, 0x0D0C, 0xA816);
  630. /*
  631. * AEPutArray()
  632. *
  633. * Availability:
  634. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  635. * CarbonLib: in CarbonLib 1.0 and later
  636. * Mac OS X: in version 10.0 and later
  637. */
  638. EXTERN_API( OSErr )
  639. AEPutArray(
  640. AEDescList * theAEDescList,
  641. AEArrayType arrayType,
  642. const AEArrayData * arrayPtr,
  643. DescType itemType,
  644. Size itemSize,
  645. long itemCount) THREEWORDINLINE(0x303C, 0x0B0D, 0xA816);
  646. /*
  647. * AEDeleteItem()
  648. *
  649. * Availability:
  650. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  651. * CarbonLib: in CarbonLib 1.0 and later
  652. * Mac OS X: in version 10.0 and later
  653. */
  654. EXTERN_API( OSErr )
  655. AEDeleteItem(
  656. AEDescList * theAEDescList,
  657. long index) THREEWORDINLINE(0x303C, 0x040E, 0xA816);
  658. /**************************************************************************
  659. The following calls apply to AERecord. Since AERecord is a subtype of
  660. AEDescList, the calls in the previous sections can also be used for
  661. AERecord an AERecord can be created by using AECreateList with isRecord
  662. set to true.
  663. **************************************************************************/
  664. /*************************************************************************
  665. AERecords can have an abitrary descriptorType. This allows you to
  666. check if desc is truly an AERecord
  667. ************************************************************************/
  668. /*
  669. * AECheckIsRecord()
  670. *
  671. * Availability:
  672. * Non-Carbon CFM: not available
  673. * CarbonLib: in CarbonLib 1.4 and later
  674. * Mac OS X: in version 10.0 and later
  675. */
  676. EXTERN_API_C( Boolean )
  677. AECheckIsRecord(const AEDesc * theDesc);
  678. /*
  679. Note: The following #defines map "key" calls on AERecords into "param" calls on
  680. AppleEvents. Although no errors are currently returned if AERecords are
  681. passed to "param" calls and AppleEvents to "key" calls, the behavior of
  682. this type of API-mixing is not explicitly documented in Inside Macintosh.
  683. It just happens that the "key" calls have the same functionality as their
  684. "param" counterparts. Since none of the "key" calls are currently available
  685. in the PowerPC IntefaceLib, the #defines exploit the fact that "key" and
  686. "param" routines can be used interchangeably, and makes sure that every
  687. invocation of a "key" API becomes an invocation of a "param" API.
  688. */
  689. #define AEPutKeyPtr(theAERecord, theAEKeyword, typeCode, dataPtr, dataSize) \
  690. AEPutParamPtr((theAERecord), (theAEKeyword), (typeCode), (dataPtr), (dataSize))
  691. #define AEPutKeyDesc(theAERecord, theAEKeyword, theAEDesc) \
  692. AEPutParamDesc((theAERecord), (theAEKeyword), (theAEDesc))
  693. #define AEGetKeyPtr(theAERecord, theAEKeyword, desiredType, typeCode, dataPtr, maxSize, actualSize) \
  694. AEGetParamPtr((theAERecord), (theAEKeyword), (desiredType), (typeCode), (dataPtr), (maxSize), (actualSize))
  695. #define AEGetKeyDesc(theAERecord, theAEKeyword, desiredType, result) \
  696. AEGetParamDesc((theAERecord), (theAEKeyword), (desiredType), (result))
  697. #define AESizeOfKeyDesc(theAERecord, theAEKeyword, typeCode, dataSize) \
  698. AESizeOfParam((theAERecord), (theAEKeyword), (typeCode), (dataSize))
  699. #define AEDeleteKeyDesc(theAERecord, theAEKeyword) \
  700. AEDeleteParam((theAERecord), (theAEKeyword))
  701. /**************************************************************************
  702. The following calls create and manipulate the AppleEvent data type.
  703. **************************************************************************/
  704. /*
  705. * AECreateAppleEvent()
  706. *
  707. * Availability:
  708. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  709. * CarbonLib: in CarbonLib 1.0 and later
  710. * Mac OS X: in version 10.0 and later
  711. */
  712. EXTERN_API( OSErr )
  713. AECreateAppleEvent(
  714. AEEventClass theAEEventClass,
  715. AEEventID theAEEventID,
  716. const AEAddressDesc * target,
  717. AEReturnID returnID,
  718. AETransactionID transactionID,
  719. AppleEvent * result) THREEWORDINLINE(0x303C, 0x0B14, 0xA816);
  720. /**************************************************************************
  721. The following calls are used to pack and unpack parameters from records
  722. of type AppleEvent. Since AppleEvent is a subtype of AERecord, the calls
  723. in the previous sections can also be used for variables of type
  724. AppleEvent. The next six calls are in fact identical to the six calls
  725. for AERecord.
  726. **************************************************************************/
  727. /*
  728. * AEPutParamPtr()
  729. *
  730. * Availability:
  731. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  732. * CarbonLib: in CarbonLib 1.0 and later
  733. * Mac OS X: in version 10.0 and later
  734. */
  735. EXTERN_API( OSErr )
  736. AEPutParamPtr(
  737. AppleEvent * theAppleEvent,
  738. AEKeyword theAEKeyword,
  739. DescType typeCode,
  740. const void * dataPtr,
  741. Size dataSize) THREEWORDINLINE(0x303C, 0x0A0F, 0xA816);
  742. /*
  743. * AEPutParamDesc()
  744. *
  745. * Availability:
  746. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  747. * CarbonLib: in CarbonLib 1.0 and later
  748. * Mac OS X: in version 10.0 and later
  749. */
  750. EXTERN_API( OSErr )
  751. AEPutParamDesc(
  752. AppleEvent * theAppleEvent,
  753. AEKeyword theAEKeyword,
  754. const AEDesc * theAEDesc) THREEWORDINLINE(0x303C, 0x0610, 0xA816);
  755. /*
  756. * AEGetParamPtr()
  757. *
  758. * Availability:
  759. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  760. * CarbonLib: in CarbonLib 1.0 and later
  761. * Mac OS X: in version 10.0 and later
  762. */
  763. EXTERN_API( OSErr )
  764. AEGetParamPtr(
  765. const AppleEvent * theAppleEvent,
  766. AEKeyword theAEKeyword,
  767. DescType desiredType,
  768. DescType * typeCode,
  769. void * dataPtr,
  770. Size maximumSize,
  771. Size * actualSize) THREEWORDINLINE(0x303C, 0x0E11, 0xA816);
  772. /*
  773. * AEGetParamDesc()
  774. *
  775. * Availability:
  776. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  777. * CarbonLib: in CarbonLib 1.0 and later
  778. * Mac OS X: in version 10.0 and later
  779. */
  780. EXTERN_API( OSErr )
  781. AEGetParamDesc(
  782. const AppleEvent * theAppleEvent,
  783. AEKeyword theAEKeyword,
  784. DescType desiredType,
  785. AEDesc * result) THREEWORDINLINE(0x303C, 0x0812, 0xA816);
  786. /*
  787. * AESizeOfParam()
  788. *
  789. * Availability:
  790. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  791. * CarbonLib: in CarbonLib 1.0 and later
  792. * Mac OS X: in version 10.0 and later
  793. */
  794. EXTERN_API( OSErr )
  795. AESizeOfParam(
  796. const AppleEvent * theAppleEvent,
  797. AEKeyword theAEKeyword,
  798. DescType * typeCode,
  799. Size * dataSize) THREEWORDINLINE(0x303C, 0x0829, 0xA816);
  800. /*
  801. * AEDeleteParam()
  802. *
  803. * Availability:
  804. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  805. * CarbonLib: in CarbonLib 1.0 and later
  806. * Mac OS X: in version 10.0 and later
  807. */
  808. EXTERN_API( OSErr )
  809. AEDeleteParam(
  810. AppleEvent * theAppleEvent,
  811. AEKeyword theAEKeyword) THREEWORDINLINE(0x303C, 0x0413, 0xA816);
  812. /**************************************************************************
  813. The following calls also apply to type AppleEvent. Message attributes are
  814. far more restricted, and can only be accessed through the following 5
  815. calls. The various list and record routines cannot be used to access the
  816. attributes of an event.
  817. **************************************************************************/
  818. /*
  819. * AEGetAttributePtr()
  820. *
  821. * Availability:
  822. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  823. * CarbonLib: in CarbonLib 1.0 and later
  824. * Mac OS X: in version 10.0 and later
  825. */
  826. EXTERN_API( OSErr )
  827. AEGetAttributePtr(
  828. const AppleEvent * theAppleEvent,
  829. AEKeyword theAEKeyword,
  830. DescType desiredType,
  831. DescType * typeCode,
  832. void * dataPtr,
  833. Size maximumSize,
  834. Size * actualSize) THREEWORDINLINE(0x303C, 0x0E15, 0xA816);
  835. /*
  836. * AEGetAttributeDesc()
  837. *
  838. * Availability:
  839. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  840. * CarbonLib: in CarbonLib 1.0 and later
  841. * Mac OS X: in version 10.0 and later
  842. */
  843. EXTERN_API( OSErr )
  844. AEGetAttributeDesc(
  845. const AppleEvent * theAppleEvent,
  846. AEKeyword theAEKeyword,
  847. DescType desiredType,
  848. AEDesc * result) THREEWORDINLINE(0x303C, 0x0826, 0xA816);
  849. /*
  850. * AESizeOfAttribute()
  851. *
  852. * Availability:
  853. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  854. * CarbonLib: in CarbonLib 1.0 and later
  855. * Mac OS X: in version 10.0 and later
  856. */
  857. EXTERN_API( OSErr )
  858. AESizeOfAttribute(
  859. const AppleEvent * theAppleEvent,
  860. AEKeyword theAEKeyword,
  861. DescType * typeCode,
  862. Size * dataSize) THREEWORDINLINE(0x303C, 0x0828, 0xA816);
  863. /*
  864. * AEPutAttributePtr()
  865. *
  866. * Availability:
  867. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  868. * CarbonLib: in CarbonLib 1.0 and later
  869. * Mac OS X: in version 10.0 and later
  870. */
  871. EXTERN_API( OSErr )
  872. AEPutAttributePtr(
  873. AppleEvent * theAppleEvent,
  874. AEKeyword theAEKeyword,
  875. DescType typeCode,
  876. const void * dataPtr,
  877. Size dataSize) THREEWORDINLINE(0x303C, 0x0A16, 0xA816);
  878. /*
  879. * AEPutAttributeDesc()
  880. *
  881. * Availability:
  882. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  883. * CarbonLib: in CarbonLib 1.0 and later
  884. * Mac OS X: in version 10.0 and later
  885. */
  886. EXTERN_API( OSErr )
  887. AEPutAttributeDesc(
  888. AppleEvent * theAppleEvent,
  889. AEKeyword theAEKeyword,
  890. const AEDesc * theAEDesc) THREEWORDINLINE(0x303C, 0x0627, 0xA816);
  891. /**************************************************************************
  892. AppleEvent Serialization Support
  893. AESizeOfFlattenedDesc, AEFlattenDesc, AEUnflattenDesc
  894. These calls will work for all AppleEvent data types and between different
  895. versions of the OS (including between Mac OS 9 and X)
  896. Basic types, AEDesc, AEList and AERecord are OK, but AppleEvent records
  897. themselves may not be reliably flattened for storage.
  898. **************************************************************************/
  899. /*
  900. AEFlattenDesc
  901. Returns the amount of buffer space needed to flatten the
  902. AEDesc. Call this before AEFlattenDesc to make sure your
  903. buffer has enough room for the operation.
  904. */
  905. /*
  906. * AESizeOfFlattenedDesc()
  907. *
  908. * Availability:
  909. * Non-Carbon CFM: not available
  910. * CarbonLib: in CarbonLib 1.4 and later
  911. * Mac OS X: in version 10.0 and later
  912. */
  913. EXTERN_API_C( Size )
  914. AESizeOfFlattenedDesc(const AEDesc * theAEDesc);
  915. /*
  916. AEFlattenDesc
  917. Fills a buffer with a flattened representation of the
  918. AEDesc and returns the amount of buffer used in actualSize.
  919. If bufferSize was too small it returns errAEBufferTooSmall
  920. (-1741) and does not fill in any of the buffer. The resulting
  921. buffer is only useful with an AEUnflattenDesc call.
  922. Note: if you pass a NULL buffer pointer it returns noErr but
  923. fills in the actualSize field anyway.
  924. */
  925. /*
  926. * AEFlattenDesc()
  927. *
  928. * Availability:
  929. * Non-Carbon CFM: not available
  930. * CarbonLib: in CarbonLib 1.4 and later
  931. * Mac OS X: in version 10.0 and later
  932. */
  933. EXTERN_API_C( OSStatus )
  934. AEFlattenDesc(
  935. const AEDesc * theAEDesc,
  936. Ptr buffer,
  937. Size bufferSize,
  938. Size * actualSize);
  939. /*
  940. AEUnflattenDesc
  941. Allocates an AEDesc (given a Null Desc) given a flattened
  942. data buffer. It assumes it was given a good buffer filled
  943. in by AEFlattenDesc. It returns paramErr if it discovers
  944. something fishy about the buffer.
  945. */
  946. /*
  947. * AEUnflattenDesc()
  948. *
  949. * Availability:
  950. * Non-Carbon CFM: not available
  951. * CarbonLib: in CarbonLib 1.4 and later
  952. * Mac OS X: in version 10.0 and later
  953. */
  954. EXTERN_API_C( OSStatus )
  955. AEUnflattenDesc(
  956. Ptr buffer,
  957. AEDesc * result);
  958. /**************************************************************************
  959. The following calls are necessary to deal with opaque data in AEDescs, because the
  960. traditional way of dealing with a basic AEDesc has been to dereference the dataHandle
  961. directly. This is not supported under Carbon.
  962. **************************************************************************/
  963. #if ACCESSOR_CALLS_ARE_FUNCTIONS
  964. /*
  965. AEGetDescData no longer supports automatic coercion. If you'd like to
  966. coerce the descriptor use AECoerceDesc.
  967. */
  968. /*
  969. * AEGetDescData()
  970. *
  971. * Availability:
  972. * Non-Carbon CFM: in CarbonAccessors.o 1.0 and later
  973. * CarbonLib: in CarbonLib 1.0 and later
  974. * Mac OS X: in version 10.0 and later
  975. */
  976. EXTERN_API( OSErr )
  977. AEGetDescData(
  978. const AEDesc * theAEDesc,
  979. void * dataPtr,
  980. Size maximumSize);
  981. /*
  982. * AEGetDescDataSize()
  983. *
  984. * Availability:
  985. * Non-Carbon CFM: in CarbonAccessors.o 1.0 and later
  986. * CarbonLib: in CarbonLib 1.0 and later
  987. * Mac OS X: in version 10.0 and later
  988. */
  989. EXTERN_API( Size )
  990. AEGetDescDataSize(const AEDesc * theAEDesc);
  991. /*
  992. * AEReplaceDescData()
  993. *
  994. * Availability:
  995. * Non-Carbon CFM: in CarbonAccessors.o 1.0 and later
  996. * CarbonLib: in CarbonLib 1.0 and later
  997. * Mac OS X: in version 10.0 and later
  998. */
  999. EXTERN_API( OSErr )
  1000. AEReplaceDescData(
  1001. DescType typeCode,
  1002. const void * dataPtr,
  1003. Size dataSize,
  1004. AEDesc * theAEDesc);
  1005. #endif /* ACCESSOR_CALLS_ARE_FUNCTIONS */
  1006. /*
  1007. * Retrieve a range of bytes from an AEDesc. This obviates the need
  1008. * to retrieve the entire data from the event using AEGetDescData.
  1009. * This is only valid for data type AEDescs. If the requested length
  1010. * and offset are such that they do not fit entirely with the data of the
  1011. * desc, errAEBufferTooSmall is returned.
  1012. */
  1013. /*
  1014. * AEGetDescDataRange()
  1015. *
  1016. * Availability:
  1017. * Non-Carbon CFM: not available
  1018. * CarbonLib: not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
  1019. * Mac OS X: in version 10.2 and later
  1020. */
  1021. EXTERN_API_C( OSStatus )
  1022. AEGetDescDataRange(
  1023. const AEDesc * dataDesc,
  1024. void * buffer,
  1025. Size offset,
  1026. Size length);
  1027. /**************************************************************************
  1028. A AEEventHandler is installed to process an AppleEvent
  1029. **************************************************************************/
  1030. typedef CALLBACK_API( OSErr , AEEventHandlerProcPtr )(const AppleEvent *theAppleEvent, AppleEvent *reply, long handlerRefcon);
  1031. typedef STACK_UPP_TYPE(AEEventHandlerProcPtr) AEEventHandlerUPP;
  1032. /*
  1033. * NewAEDisposeExternalUPP()
  1034. *
  1035. * Availability:
  1036. * Non-Carbon CFM: available as macro/inline
  1037. * CarbonLib: not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
  1038. * Mac OS X: in version 10.2 and later
  1039. */
  1040. EXTERN_API_C( AEDisposeExternalUPP )
  1041. NewAEDisposeExternalUPP(AEDisposeExternalProcPtr userRoutine);
  1042. #if !OPAQUE_UPP_TYPES
  1043. enum { uppAEDisposeExternalProcInfo = 0x00000FC0 }; /* pascal no_return_value Func(4_bytes, 4_bytes, 4_bytes) */
  1044. #ifdef __cplusplus
  1045. inline DEFINE_API_C(AEDisposeExternalUPP) NewAEDisposeExternalUPP(AEDisposeExternalProcPtr userRoutine) { return (AEDisposeExternalUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppAEDisposeExternalProcInfo, GetCurrentArchitecture()); }
  1046. #else
  1047. #define NewAEDisposeExternalUPP(userRoutine) (AEDisposeExternalUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppAEDisposeExternalProcInfo, GetCurrentArchitecture())
  1048. #endif
  1049. #endif
  1050. /*
  1051. * NewAEEventHandlerUPP()
  1052. *
  1053. * Availability:
  1054. * Non-Carbon CFM: available as macro/inline
  1055. * CarbonLib: in CarbonLib 1.0 and later
  1056. * Mac OS X: in version 10.0 and later
  1057. */
  1058. EXTERN_API_C( AEEventHandlerUPP )
  1059. NewAEEventHandlerUPP(AEEventHandlerProcPtr userRoutine);
  1060. #if !OPAQUE_UPP_TYPES
  1061. enum { uppAEEventHandlerProcInfo = 0x00000FE0 }; /* pascal 2_bytes Func(4_bytes, 4_bytes, 4_bytes) */
  1062. #ifdef __cplusplus
  1063. inline DEFINE_API_C(AEEventHandlerUPP) NewAEEventHandlerUPP(AEEventHandlerProcPtr userRoutine) { return (AEEventHandlerUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppAEEventHandlerProcInfo, GetCurrentArchitecture()); }
  1064. #else
  1065. #define NewAEEventHandlerUPP(userRoutine) (AEEventHandlerUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppAEEventHandlerProcInfo, GetCurrentArchitecture())
  1066. #endif
  1067. #endif
  1068. /*
  1069. * DisposeAEDisposeExternalUPP()
  1070. *
  1071. * Availability:
  1072. * Non-Carbon CFM: available as macro/inline
  1073. * CarbonLib: not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
  1074. * Mac OS X: in version 10.2 and later
  1075. */
  1076. EXTERN_API_C( void )
  1077. DisposeAEDisposeExternalUPP(AEDisposeExternalUPP userUPP);
  1078. #if !OPAQUE_UPP_TYPES
  1079. #ifdef __cplusplus
  1080. inline DEFINE_API_C(void) DisposeAEDisposeExternalUPP(AEDisposeExternalUPP userUPP) { DisposeRoutineDescriptor((UniversalProcPtr)userUPP); }
  1081. #else
  1082. #define DisposeAEDisposeExternalUPP(userUPP) DisposeRoutineDescriptor(userUPP)
  1083. #endif
  1084. #endif
  1085. /*
  1086. * DisposeAEEventHandlerUPP()
  1087. *
  1088. * Availability:
  1089. * Non-Carbon CFM: available as macro/inline
  1090. * CarbonLib: in CarbonLib 1.0 and later
  1091. * Mac OS X: in version 10.0 and later
  1092. */
  1093. EXTERN_API_C( void )
  1094. DisposeAEEventHandlerUPP(AEEventHandlerUPP userUPP);
  1095. #if !OPAQUE_UPP_TYPES
  1096. #ifdef __cplusplus
  1097. inline DEFINE_API_C(void) DisposeAEEventHandlerUPP(AEEventHandlerUPP userUPP) { DisposeRoutineDescriptor((UniversalProcPtr)userUPP); }
  1098. #else
  1099. #define DisposeAEEventHandlerUPP(userUPP) DisposeRoutineDescriptor(userUPP)
  1100. #endif
  1101. #endif
  1102. /*
  1103. * InvokeAEDisposeExternalUPP()
  1104. *
  1105. * Availability:
  1106. * Non-Carbon CFM: available as macro/inline
  1107. * CarbonLib: not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
  1108. * Mac OS X: in version 10.2 and later
  1109. */
  1110. EXTERN_API_C( void )
  1111. InvokeAEDisposeExternalUPP(
  1112. const void * dataPtr,
  1113. Size dataLength,
  1114. long refcon,
  1115. AEDisposeExternalUPP userUPP);
  1116. #if !OPAQUE_UPP_TYPES
  1117. #ifdef __cplusplus
  1118. inline DEFINE_API_C(void) InvokeAEDisposeExternalUPP(const void * dataPtr, Size dataLength, long refcon, AEDisposeExternalUPP userUPP) { CALL_THREE_PARAMETER_UPP(userUPP, uppAEDisposeExternalProcInfo, dataPtr, dataLength, refcon); }
  1119. #else
  1120. #define InvokeAEDisposeExternalUPP(dataPtr, dataLength, refcon, userUPP) CALL_THREE_PARAMETER_UPP((userUPP), uppAEDisposeExternalProcInfo, (dataPtr), (dataLength), (refcon))
  1121. #endif
  1122. #endif
  1123. /*
  1124. * InvokeAEEventHandlerUPP()
  1125. *
  1126. * Availability:
  1127. * Non-Carbon CFM: available as macro/inline
  1128. * CarbonLib: in CarbonLib 1.0 and later
  1129. * Mac OS X: in version 10.0 and later
  1130. */
  1131. EXTERN_API_C( OSErr )
  1132. InvokeAEEventHandlerUPP(
  1133. const AppleEvent * theAppleEvent,
  1134. AppleEvent * reply,
  1135. long handlerRefcon,
  1136. AEEventHandlerUPP userUPP);
  1137. #if !OPAQUE_UPP_TYPES
  1138. #ifdef __cplusplus
  1139. inline DEFINE_API_C(OSErr) InvokeAEEventHandlerUPP(const AppleEvent * theAppleEvent, AppleEvent * reply, long handlerRefcon, AEEventHandlerUPP userUPP) { return (OSErr)CALL_THREE_PARAMETER_UPP(userUPP, uppAEEventHandlerProcInfo, theAppleEvent, reply, handlerRefcon); }
  1140. #else
  1141. #define InvokeAEEventHandlerUPP(theAppleEvent, reply, handlerRefcon, userUPP) (OSErr)CALL_THREE_PARAMETER_UPP((userUPP), uppAEEventHandlerProcInfo, (theAppleEvent), (reply), (handlerRefcon))
  1142. #endif
  1143. #endif
  1144. #if CALL_NOT_IN_CARBON || OLDROUTINENAMES
  1145. /* support for pre-Carbon UPP routines: New...Proc and Call...Proc */
  1146. #define NewAEDisposeExternalProc(userRoutine) NewAEDisposeExternalUPP(userRoutine)
  1147. #define NewAEEventHandlerProc(userRoutine) NewAEEventHandlerUPP(userRoutine)
  1148. #define CallAEDisposeExternalProc(userRoutine, dataPtr, dataLength, refcon) InvokeAEDisposeExternalUPP(dataPtr, dataLength, refcon, userRoutine)
  1149. #define CallAEEventHandlerProc(userRoutine, theAppleEvent, reply, handlerRefcon) InvokeAEEventHandlerUPP(theAppleEvent, reply, handlerRefcon, userRoutine)
  1150. #endif /* CALL_NOT_IN_CARBON */
  1151. #if PRAGMA_STRUCT_ALIGN
  1152. #pragma options align=reset
  1153. #elif PRAGMA_STRUCT_PACKPUSH
  1154. #pragma pack(pop)
  1155. #elif PRAGMA_STRUCT_PACK
  1156. #pragma pack()
  1157. #endif
  1158. #ifdef PRAGMA_IMPORT_OFF
  1159. #pragma import off
  1160. #elif PRAGMA_IMPORT
  1161. #pragma import reset
  1162. #endif
  1163. #ifdef __cplusplus
  1164. }
  1165. #endif
  1166. #endif /* __AEDATAMODEL__ */