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.

1947 lines
69 KiB

  1. /*
  2. File: OSA.h
  3. Contains: Open Scripting Architecture Client Interfaces.
  4. Version: QuickTime 7.3
  5. Copyright: (c) 2007 (c) 1992-2000 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 __OSA__
  11. #define __OSA__
  12. #ifndef __MACERRORS__
  13. #include <MacErrors.h>
  14. #endif
  15. #ifndef __COMPONENTS__
  16. #include <Components.h>
  17. #endif
  18. #ifndef __APPLEEVENTS__
  19. #include <AppleEvents.h>
  20. #endif
  21. #ifndef __AEOBJECTS__
  22. #include <AEObjects.h>
  23. #endif
  24. #ifndef __AEINTERACTION__
  25. #include <AEInteraction.h>
  26. #endif
  27. #if PRAGMA_ONCE
  28. #pragma once
  29. #endif
  30. #ifdef __cplusplus
  31. extern "C" {
  32. #endif
  33. #if PRAGMA_IMPORT
  34. #pragma import on
  35. #endif
  36. #if PRAGMA_STRUCT_ALIGN
  37. #pragma options align=mac68k
  38. #elif PRAGMA_STRUCT_PACKPUSH
  39. #pragma pack(push, 2)
  40. #elif PRAGMA_STRUCT_PACK
  41. #pragma pack(2)
  42. #endif
  43. /**************************************************************************
  44. Types and Constants
  45. **************************************************************************/
  46. /* The componenent manager type code for components that
  47. support the OSA interface defined here. */
  48. /* 0x6f736120 */
  49. enum {
  50. kOSAComponentType = FOUR_CHAR_CODE('osa ')
  51. };
  52. /* 0x73637074 */
  53. enum {
  54. kOSAGenericScriptingComponentSubtype = FOUR_CHAR_CODE('scpt')
  55. };
  56. /* Type of script document files. */
  57. /* 0x6f736173 */
  58. enum {
  59. kOSAFileType = FOUR_CHAR_CODE('osas')
  60. };
  61. /*
  62. Suite and event code of the RecordedText event.
  63. (See OSAStartRecording, below.)
  64. */
  65. /* 0x61736372 */
  66. enum {
  67. kOSASuite = FOUR_CHAR_CODE('ascr')
  68. };
  69. /* 0x72656364 */
  70. enum {
  71. kOSARecordedText = FOUR_CHAR_CODE('recd')
  72. };
  73. /* Selector returns boolean */
  74. /* 0x6d6f6469 */
  75. enum {
  76. kOSAScriptIsModified = FOUR_CHAR_CODE('modi')
  77. };
  78. /* Selector returns boolean */
  79. /* 0x63736372 */
  80. enum {
  81. kOSAScriptIsTypeCompiledScript = FOUR_CHAR_CODE('cscr')
  82. };
  83. /* Selector returns boolean */
  84. /* 0x76616c75 */
  85. enum {
  86. kOSAScriptIsTypeScriptValue = FOUR_CHAR_CODE('valu')
  87. };
  88. /* Selector returns boolean */
  89. /* 0x636e7478 */
  90. enum {
  91. kOSAScriptIsTypeScriptContext = FOUR_CHAR_CODE('cntx')
  92. };
  93. /* Selector returns a DescType which may be passed to OSACoerceToDesc */
  94. /* 0x62657374 */
  95. enum {
  96. kOSAScriptBestType = FOUR_CHAR_CODE('best')
  97. };
  98. /*
  99. This selector is used to determine whether a script has source
  100. associated with it that when given to OSAGetSource, the call will not
  101. fail. The selector returns a boolean.
  102. */
  103. /* 0x67737263 */
  104. enum {
  105. kOSACanGetSource = FOUR_CHAR_CODE('gsrc')
  106. };
  107. enum {
  108. typeOSADialectInfo = FOUR_CHAR_CODE('difo'), /* 0x6469666f */
  109. keyOSADialectName = FOUR_CHAR_CODE('dnam'), /* 0x646e616d */
  110. keyOSADialectCode = FOUR_CHAR_CODE('dcod'), /* 0x64636f64 */
  111. keyOSADialectLangCode = FOUR_CHAR_CODE('dlcd'), /* 0x646c6364 */
  112. keyOSADialectScriptCode = FOUR_CHAR_CODE('dscd') /* 0x64736364 */
  113. };
  114. typedef ComponentResult OSAError;
  115. /* Under the Open Scripting Architecture all error results are longs */
  116. typedef unsigned long OSAID;
  117. /*
  118. OSAIDs allow transparent manipulation of scripts associated with
  119. various scripting systems.
  120. */
  121. enum {
  122. kOSANullScript = 0L
  123. };
  124. /* No -script constant. */
  125. enum {
  126. kOSANullMode = 0, /* sounds better */
  127. kOSAModeNull = 0 /* tastes consistent */
  128. };
  129. /*
  130. Some routines take flags that control their execution. This constant
  131. declares default mode settings are used.
  132. */
  133. typedef CALLBACK_API( OSErr , OSACreateAppleEventProcPtr )(AEEventClass theAEEventClass, AEEventID theAEEventID, const AEAddressDesc *target, short returnID, long transactionID, AppleEvent *result, long refCon);
  134. typedef CALLBACK_API( OSErr , OSASendProcPtr )(const AppleEvent *theAppleEvent, AppleEvent *reply, AESendMode sendMode, AESendPriority sendPriority, long timeOutInTicks, AEIdleUPP idleProc, AEFilterUPP filterProc, long refCon);
  135. typedef STACK_UPP_TYPE(OSACreateAppleEventProcPtr) OSACreateAppleEventUPP;
  136. typedef STACK_UPP_TYPE(OSASendProcPtr) OSASendUPP;
  137. /*
  138. * NewOSACreateAppleEventUPP()
  139. *
  140. * Availability:
  141. * Non-Carbon CFM: available as macro/inline
  142. * CarbonLib: in CarbonLib 1.0 and later
  143. * Mac OS X: in version 10.0 and later
  144. */
  145. EXTERN_API_C( OSACreateAppleEventUPP )
  146. NewOSACreateAppleEventUPP(OSACreateAppleEventProcPtr userRoutine);
  147. #if !OPAQUE_UPP_TYPES
  148. enum { uppOSACreateAppleEventProcInfo = 0x000FEFE0 }; /* pascal 2_bytes Func(4_bytes, 4_bytes, 4_bytes, 2_bytes, 4_bytes, 4_bytes, 4_bytes) */
  149. #ifdef __cplusplus
  150. inline DEFINE_API_C(OSACreateAppleEventUPP) NewOSACreateAppleEventUPP(OSACreateAppleEventProcPtr userRoutine) { return (OSACreateAppleEventUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppOSACreateAppleEventProcInfo, GetCurrentArchitecture()); }
  151. #else
  152. #define NewOSACreateAppleEventUPP(userRoutine) (OSACreateAppleEventUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppOSACreateAppleEventProcInfo, GetCurrentArchitecture())
  153. #endif
  154. #endif
  155. /*
  156. * NewOSASendUPP()
  157. *
  158. * Availability:
  159. * Non-Carbon CFM: available as macro/inline
  160. * CarbonLib: in CarbonLib 1.0 and later
  161. * Mac OS X: in version 10.0 and later
  162. */
  163. EXTERN_API_C( OSASendUPP )
  164. NewOSASendUPP(OSASendProcPtr userRoutine);
  165. #if !OPAQUE_UPP_TYPES
  166. enum { uppOSASendProcInfo = 0x003FEFE0 }; /* pascal 2_bytes Func(4_bytes, 4_bytes, 4_bytes, 2_bytes, 4_bytes, 4_bytes, 4_bytes, 4_bytes) */
  167. #ifdef __cplusplus
  168. inline DEFINE_API_C(OSASendUPP) NewOSASendUPP(OSASendProcPtr userRoutine) { return (OSASendUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppOSASendProcInfo, GetCurrentArchitecture()); }
  169. #else
  170. #define NewOSASendUPP(userRoutine) (OSASendUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppOSASendProcInfo, GetCurrentArchitecture())
  171. #endif
  172. #endif
  173. /*
  174. * DisposeOSACreateAppleEventUPP()
  175. *
  176. * Availability:
  177. * Non-Carbon CFM: available as macro/inline
  178. * CarbonLib: in CarbonLib 1.0 and later
  179. * Mac OS X: in version 10.0 and later
  180. */
  181. EXTERN_API_C( void )
  182. DisposeOSACreateAppleEventUPP(OSACreateAppleEventUPP userUPP);
  183. #if !OPAQUE_UPP_TYPES
  184. #ifdef __cplusplus
  185. inline DEFINE_API_C(void) DisposeOSACreateAppleEventUPP(OSACreateAppleEventUPP userUPP) { DisposeRoutineDescriptor((UniversalProcPtr)userUPP); }
  186. #else
  187. #define DisposeOSACreateAppleEventUPP(userUPP) DisposeRoutineDescriptor(userUPP)
  188. #endif
  189. #endif
  190. /*
  191. * DisposeOSASendUPP()
  192. *
  193. * Availability:
  194. * Non-Carbon CFM: available as macro/inline
  195. * CarbonLib: in CarbonLib 1.0 and later
  196. * Mac OS X: in version 10.0 and later
  197. */
  198. EXTERN_API_C( void )
  199. DisposeOSASendUPP(OSASendUPP userUPP);
  200. #if !OPAQUE_UPP_TYPES
  201. #ifdef __cplusplus
  202. inline DEFINE_API_C(void) DisposeOSASendUPP(OSASendUPP userUPP) { DisposeRoutineDescriptor((UniversalProcPtr)userUPP); }
  203. #else
  204. #define DisposeOSASendUPP(userUPP) DisposeRoutineDescriptor(userUPP)
  205. #endif
  206. #endif
  207. /*
  208. * InvokeOSACreateAppleEventUPP()
  209. *
  210. * Availability:
  211. * Non-Carbon CFM: available as macro/inline
  212. * CarbonLib: in CarbonLib 1.0 and later
  213. * Mac OS X: in version 10.0 and later
  214. */
  215. EXTERN_API_C( OSErr )
  216. InvokeOSACreateAppleEventUPP(
  217. AEEventClass theAEEventClass,
  218. AEEventID theAEEventID,
  219. const AEAddressDesc * target,
  220. short returnID,
  221. long transactionID,
  222. AppleEvent * result,
  223. long refCon,
  224. OSACreateAppleEventUPP userUPP);
  225. #if !OPAQUE_UPP_TYPES
  226. #ifdef __cplusplus
  227. inline DEFINE_API_C(OSErr) InvokeOSACreateAppleEventUPP(AEEventClass theAEEventClass, AEEventID theAEEventID, const AEAddressDesc * target, short returnID, long transactionID, AppleEvent * result, long refCon, OSACreateAppleEventUPP userUPP) { return (OSErr)CALL_SEVEN_PARAMETER_UPP(userUPP, uppOSACreateAppleEventProcInfo, theAEEventClass, theAEEventID, target, returnID, transactionID, result, refCon); }
  228. #else
  229. #define InvokeOSACreateAppleEventUPP(theAEEventClass, theAEEventID, target, returnID, transactionID, result, refCon, userUPP) (OSErr)CALL_SEVEN_PARAMETER_UPP((userUPP), uppOSACreateAppleEventProcInfo, (theAEEventClass), (theAEEventID), (target), (returnID), (transactionID), (result), (refCon))
  230. #endif
  231. #endif
  232. /*
  233. * InvokeOSASendUPP()
  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( OSErr )
  241. InvokeOSASendUPP(
  242. const AppleEvent * theAppleEvent,
  243. AppleEvent * reply,
  244. AESendMode sendMode,
  245. AESendPriority sendPriority,
  246. long timeOutInTicks,
  247. AEIdleUPP idleProc,
  248. AEFilterUPP filterProc,
  249. long refCon,
  250. OSASendUPP userUPP);
  251. #if !OPAQUE_UPP_TYPES
  252. #ifdef __cplusplus
  253. inline DEFINE_API_C(OSErr) InvokeOSASendUPP(const AppleEvent * theAppleEvent, AppleEvent * reply, AESendMode sendMode, AESendPriority sendPriority, long timeOutInTicks, AEIdleUPP idleProc, AEFilterUPP filterProc, long refCon, OSASendUPP userUPP) { return (OSErr)CALL_EIGHT_PARAMETER_UPP(userUPP, uppOSASendProcInfo, theAppleEvent, reply, sendMode, sendPriority, timeOutInTicks, idleProc, filterProc, refCon); }
  254. #else
  255. #define InvokeOSASendUPP(theAppleEvent, reply, sendMode, sendPriority, timeOutInTicks, idleProc, filterProc, refCon, userUPP) (OSErr)CALL_EIGHT_PARAMETER_UPP((userUPP), uppOSASendProcInfo, (theAppleEvent), (reply), (sendMode), (sendPriority), (timeOutInTicks), (idleProc), (filterProc), (refCon))
  256. #endif
  257. #endif
  258. #if CALL_NOT_IN_CARBON || OLDROUTINENAMES
  259. /* support for pre-Carbon UPP routines: New...Proc and Call...Proc */
  260. #define NewOSACreateAppleEventProc(userRoutine) NewOSACreateAppleEventUPP(userRoutine)
  261. #define NewOSASendProc(userRoutine) NewOSASendUPP(userRoutine)
  262. #define CallOSACreateAppleEventProc(userRoutine, theAEEventClass, theAEEventID, target, returnID, transactionID, result, refCon) InvokeOSACreateAppleEventUPP(theAEEventClass, theAEEventID, target, returnID, transactionID, result, refCon, userRoutine)
  263. #define CallOSASendProc(userRoutine, theAppleEvent, reply, sendMode, sendPriority, timeOutInTicks, idleProc, filterProc, refCon) InvokeOSASendUPP(theAppleEvent, reply, sendMode, sendPriority, timeOutInTicks, idleProc, filterProc, refCon, userRoutine)
  264. #endif /* CALL_NOT_IN_CARBON */
  265. /**************************************************************************
  266. OSA Interface Descriptions
  267. **************************************************************************
  268. The OSA Interface is broken down into a required interface, and several
  269. optional interfaces to support additional functionality. A given scripting
  270. component may choose to support only some of the optional interfaces in
  271. addition to the basic interface. The OSA Component Flags may be used to
  272. query the Component Manager to find a scripting component with a particular
  273. capability, or determine if a particular scripting component supports a
  274. particular capability.
  275. **************************************************************************/
  276. /* OSA Component Flags: */
  277. enum {
  278. kOSASupportsCompiling = 0x0002,
  279. kOSASupportsGetSource = 0x0004,
  280. kOSASupportsAECoercion = 0x0008,
  281. kOSASupportsAESending = 0x0010,
  282. kOSASupportsRecording = 0x0020,
  283. kOSASupportsConvenience = 0x0040,
  284. kOSASupportsDialects = 0x0080,
  285. kOSASupportsEventHandling = 0x0100
  286. };
  287. /* Component Selectors: */
  288. enum {
  289. kOSASelectLoad = 0x0001,
  290. kOSASelectStore = 0x0002,
  291. kOSASelectExecute = 0x0003,
  292. kOSASelectDisplay = 0x0004,
  293. kOSASelectScriptError = 0x0005,
  294. kOSASelectDispose = 0x0006,
  295. kOSASelectSetScriptInfo = 0x0007,
  296. kOSASelectGetScriptInfo = 0x0008,
  297. kOSASelectSetActiveProc = 0x0009,
  298. kOSASelectGetActiveProc = 0x000A
  299. };
  300. /* Compiling: */
  301. enum {
  302. kOSASelectScriptingComponentName = 0x0102,
  303. kOSASelectCompile = 0x0103,
  304. kOSASelectCopyID = 0x0104
  305. };
  306. /* GetSource: */
  307. enum {
  308. kOSASelectGetSource = 0x0201
  309. };
  310. /* AECoercion: */
  311. enum {
  312. kOSASelectCoerceFromDesc = 0x0301,
  313. kOSASelectCoerceToDesc = 0x0302
  314. };
  315. /* AESending: */
  316. enum {
  317. kOSASelectSetSendProc = 0x0401,
  318. kOSASelectGetSendProc = 0x0402,
  319. kOSASelectSetCreateProc = 0x0403,
  320. kOSASelectGetCreateProc = 0x0404,
  321. kOSASelectSetDefaultTarget = 0x0405
  322. };
  323. /* Recording: */
  324. enum {
  325. kOSASelectStartRecording = 0x0501,
  326. kOSASelectStopRecording = 0x0502
  327. };
  328. /* Convenience: */
  329. enum {
  330. kOSASelectLoadExecute = 0x0601,
  331. kOSASelectCompileExecute = 0x0602,
  332. kOSASelectDoScript = 0x0603
  333. };
  334. /* Dialects: */
  335. enum {
  336. kOSASelectSetCurrentDialect = 0x0701,
  337. kOSASelectGetCurrentDialect = 0x0702,
  338. kOSASelectAvailableDialects = 0x0703,
  339. kOSASelectGetDialectInfo = 0x0704,
  340. kOSASelectAvailableDialectCodeList = 0x0705
  341. };
  342. /* Event Handling: */
  343. enum {
  344. kOSASelectSetResumeDispatchProc = 0x0801,
  345. kOSASelectGetResumeDispatchProc = 0x0802,
  346. kOSASelectExecuteEvent = 0x0803,
  347. kOSASelectDoEvent = 0x0804,
  348. kOSASelectMakeContext = 0x0805
  349. };
  350. /* scripting component specific selectors are added beginning with this value */
  351. enum {
  352. kOSASelectComponentSpecificStart = 0x1001
  353. };
  354. /* Mode Flags:
  355. Warning: These should not conflict with the AESend mode flags in
  356. AppleEvents.h, because we may want to use them as OSA mode flags too.
  357. */
  358. /*
  359. This mode flag may be passed to OSALoad, OSAStore or OSACompile to
  360. instruct the scripting component to not retain the "source" of an
  361. expression. This will cause the OSAGetSource call to return the error
  362. errOSASourceNotAvailable if used. However, some scripting components
  363. may not retain the source anyway. This is mainly used when either space
  364. efficiency is desired, or a script is to be "locked" so that its
  365. implementation may not be viewed.
  366. */
  367. enum {
  368. kOSAModePreventGetSource = 0x00000001
  369. };
  370. /*
  371. These mode flags may be passed to OSACompile, OSAExecute, OSALoadExecute
  372. OSACompileExecute, OSADoScript, OSAExecuteEvent, or OSADoEvent to
  373. indicate whether or not the script may interact with the user, switch
  374. layer or reconnect if necessary. Any AppleEvents will be sent with the
  375. corresponding AESend mode supplied.
  376. */
  377. enum {
  378. kOSAModeNeverInteract = kAENeverInteract,
  379. kOSAModeCanInteract = kAECanInteract,
  380. kOSAModeAlwaysInteract = kAEAlwaysInteract,
  381. kOSAModeDontReconnect = kAEDontReconnect
  382. };
  383. /*
  384. This mode flag may be passed to OSACompile, OSAExecute, OSALoadExecute
  385. OSACompileExecute, OSADoScript, OSAExecuteEvent, or OSADoEvent to
  386. indicate whether or not AppleEvents should be sent with the
  387. kAECanSwitchLayer mode flag sent or not. NOTE: This flag is exactly the
  388. opposite sense of the AppleEvent flag kAECanSwitchLayer. This is to
  389. provide a more convenient default, i.e. not supplying any mode
  390. (kOSAModeNull) means to send events with kAECanSwitchLayer. Supplying
  391. the kOSAModeCantSwitchLayer mode flag will cause AESend to be called
  392. without kAECanSwitchLayer.
  393. */
  394. enum {
  395. kOSAModeCantSwitchLayer = 0x00000040
  396. };
  397. /*
  398. This mode flag may be passed to OSACompile, OSAExecute, OSALoadExecute
  399. OSACompileExecute, OSADoScript, OSAExecuteEvent, or OSADoEvent to
  400. indicate whether or not AppleEvents should be sent with the kAEDontRecord
  401. mode flag sent or not. NOTE: This flag is exactly the opposite sense of
  402. the AppleEvent flag kAEDontRecord. This is to provide a more convenient
  403. default, i.e. not supplying any mode (kOSAModeNull) means to send events
  404. with kAEDontRecord. Supplying the kOSAModeDoRecord mode flag will
  405. cause AESend to be called without kAEDontRecord.
  406. */
  407. enum {
  408. kOSAModeDoRecord = 0x00001000
  409. };
  410. /*
  411. This is a mode flag for OSACompile that indicates that a context should
  412. be created as the result of compilation. All handler definitions are
  413. inserted into the new context, and variables are initialized by
  414. evaluating their initial values in a null context (i.e. they must be
  415. constant expressions).
  416. */
  417. enum {
  418. kOSAModeCompileIntoContext = 0x00000002
  419. };
  420. /*
  421. This is a mode flag for OSACompile that indicates that the previous
  422. script ID (input to OSACompile) should be augmented with any new
  423. definitions in the sourceData rather than replaced with a new script.
  424. This means that the previous script ID must designate a context.
  425. The presence of this flag causes the kOSAModeCompileIntoContext flag
  426. to be implicitly used, causing any new definitions to be initialized
  427. in a null context.
  428. */
  429. enum {
  430. kOSAModeAugmentContext = 0x00000004
  431. };
  432. /*
  433. This mode flag may be passed to OSADisplay or OSADoScript to indicate
  434. that output only need be human-readable, not re-compilable by OSACompile.
  435. If used, output may be arbitrarily "beautified", e.g. quotes may be left
  436. off of string values, long lists may have elipses, etc.
  437. */
  438. enum {
  439. kOSAModeDisplayForHumans = 0x00000008
  440. };
  441. /*
  442. This mode flag may be passed to OSAStore in the case where the scriptID
  443. is a context. This causes the context to be saved, but not the context's
  444. parent context. When the stored context is loaded back in, the parent
  445. will be kOSANullScript.
  446. */
  447. enum {
  448. kOSAModeDontStoreParent = 0x00010000
  449. };
  450. /*
  451. This mode flag may be passed to OSAExecuteEvent to cause the event to
  452. be dispatched to the direct object of the event. The direct object (or
  453. subject attribute if the direct object is a non-object specifier) will
  454. be resolved, and the resulting script object will be the recipient of
  455. the message. The context argument to OSAExecuteEvent will serve as the
  456. root of the lookup/resolution process.
  457. */
  458. enum {
  459. kOSAModeDispatchToDirectObject = 0x00020000
  460. };
  461. /*
  462. This mode flag may be passed to OSAExecuteEvent to indicate that
  463. components do not have to get the data of object specifier arguments.
  464. */
  465. enum {
  466. kOSAModeDontGetDataForArguments = 0x00040000
  467. };
  468. /**************************************************************************
  469. OSA Basic Scripting Interface
  470. **************************************************************************
  471. Scripting components must at least support the Basic Scripting interface.
  472. **************************************************************************/
  473. /* Loading and Storing Scripts:
  474. These routines allow scripts to be loaded and stored in their internal
  475. (possibly compiled, non-text) representation.
  476. */
  477. /* Resource type for scripts */
  478. enum {
  479. kOSAScriptResourceType = kOSAGenericScriptingComponentSubtype
  480. };
  481. /*
  482. Default type given to OSAStore which creates "generic" loadable script
  483. data descriptors.
  484. */
  485. enum {
  486. typeOSAGenericStorage = kOSAScriptResourceType
  487. };
  488. /*
  489. * OSALoad()
  490. *
  491. * Availability:
  492. * Non-Carbon CFM: in AppleScriptLib 1.1 and later
  493. * CarbonLib: in CarbonLib 1.0 and later
  494. * Mac OS X: in version 10.0 and later
  495. */
  496. EXTERN_API( OSAError )
  497. OSALoad(
  498. ComponentInstance scriptingComponent,
  499. const AEDesc * scriptData,
  500. long modeFlags,
  501. OSAID * resultingScriptID) FIVEWORDINLINE(0x2F3C, 0x000C, 0x0001, 0x7000, 0xA82A);
  502. /*
  503. OSAComponentFunctionInline(kOSASelectLoad, 12);
  504. Errors:
  505. badComponentInstance invalid scripting component instance
  506. errOSASystemError
  507. errOSABadStorageType: scriptData not for this scripting component
  508. errOSACorruptData: data seems to be corrupt
  509. errOSADataFormatObsolete script data format is no longer supported
  510. errOSADataFormatTooNew script data format is from a newer version
  511. ModeFlags:
  512. kOSAModePreventGetSource
  513. */
  514. /*
  515. * OSAStore()
  516. *
  517. * Availability:
  518. * Non-Carbon CFM: in AppleScriptLib 1.1 and later
  519. * CarbonLib: in CarbonLib 1.0 and later
  520. * Mac OS X: in version 10.0 and later
  521. */
  522. EXTERN_API( OSAError )
  523. OSAStore(
  524. ComponentInstance scriptingComponent,
  525. OSAID scriptID,
  526. DescType desiredType,
  527. long modeFlags,
  528. AEDesc * resultingScriptData) FIVEWORDINLINE(0x2F3C, 0x0010, 0x0002, 0x7000, 0xA82A);
  529. /*
  530. OSAComponentFunctionInline(kOSASelectStore, 16);
  531. Errors:
  532. badComponentInstance invalid scripting component instance
  533. errOSASystemError
  534. errOSAInvalidID
  535. errOSABadStorageType: desiredType not for this scripting component
  536. ModeFlags:
  537. kOSAModePreventGetSource
  538. kOSAModeDontStoreParent
  539. */
  540. /* Executing Scripts: */
  541. /*
  542. * OSAExecute()
  543. *
  544. * Availability:
  545. * Non-Carbon CFM: in AppleScriptLib 1.1 and later
  546. * CarbonLib: in CarbonLib 1.0 and later
  547. * Mac OS X: in version 10.0 and later
  548. */
  549. EXTERN_API( OSAError )
  550. OSAExecute(
  551. ComponentInstance scriptingComponent,
  552. OSAID compiledScriptID,
  553. OSAID contextID,
  554. long modeFlags,
  555. OSAID * resultingScriptValueID) FIVEWORDINLINE(0x2F3C, 0x0010, 0x0003, 0x7000, 0xA82A);
  556. /*
  557. OSAComponentFunctionInline(kOSASelectExecute, 16);
  558. This call runs a script. The contextID represents the environment
  559. with which global variables in the script are resolved. The constant
  560. kOSANullScript may be used for the contextID if the application wishes
  561. to not deal with context directly (a default one is associated with each
  562. scripting component instance). The resultingScriptValueID is the
  563. result of evaluation, and contains a value which may be displayed using
  564. the OSAGetSource call. The modeFlags convey scripting component
  565. specific information.
  566. Errors:
  567. badComponentInstance invalid scripting component instance
  568. errOSASystemError
  569. errOSAInvalidID
  570. errOSAScriptError: the executing script got an error
  571. ModeFlags:
  572. kOSAModeNeverInteract
  573. kOSAModeCanInteract
  574. kOSAModeAlwaysInteract
  575. kOSAModeCantSwitchLayer
  576. kOSAModeDontReconnect
  577. kOSAModeDoRecord
  578. */
  579. /* Displaying results: */
  580. /*
  581. * OSADisplay()
  582. *
  583. * Availability:
  584. * Non-Carbon CFM: in AppleScriptLib 1.1 and later
  585. * CarbonLib: in CarbonLib 1.0 and later
  586. * Mac OS X: in version 10.0 and later
  587. */
  588. EXTERN_API( OSAError )
  589. OSADisplay(
  590. ComponentInstance scriptingComponent,
  591. OSAID scriptValueID,
  592. DescType desiredType,
  593. long modeFlags,
  594. AEDesc * resultingText) FIVEWORDINLINE(0x2F3C, 0x0010, 0x0004, 0x7000, 0xA82A);
  595. /*
  596. OSAComponentFunctionInline(kOSASelectDisplay, 16);
  597. This call is used to convert results (script value IDs) into displayable
  598. text. The desiredType should be at least typeChar, and modeFlags are
  599. scripting system specific flags to control the formatting of the
  600. resulting text. This call differs from OSAGetSource in that (1) it
  601. always produces at least typeChar, (2) is only works on script values,
  602. (3) it may display it's output in non-compilable form (e.g. without
  603. string quotes, elipses inserted in long and/or circular lists, etc.) and
  604. (4) it is required by the basic scripting interface.
  605. Errors:
  606. badComponentInstance invalid scripting component instance
  607. errOSASystemError
  608. errOSAInvalidID
  609. errAECoercionFail: desiredType not supported by scripting component
  610. ModeFlags:
  611. kOSAModeDisplayForHumans
  612. */
  613. /* Getting Error Information: */
  614. /*
  615. * OSAScriptError()
  616. *
  617. * Availability:
  618. * Non-Carbon CFM: in AppleScriptLib 1.1 and later
  619. * CarbonLib: in CarbonLib 1.0 and later
  620. * Mac OS X: in version 10.0 and later
  621. */
  622. EXTERN_API( OSAError )
  623. OSAScriptError(
  624. ComponentInstance scriptingComponent,
  625. OSType selector,
  626. DescType desiredType,
  627. AEDesc * resultingErrorDescription) FIVEWORDINLINE(0x2F3C, 0x000C, 0x0005, 0x7000, 0xA82A);
  628. /*
  629. OSAComponentFunctionInline(kOSASelectScriptError, 12);
  630. Whenever script execution returns errOSAExecutionError, this routine
  631. may be used to get information about that error. The selector describes
  632. the type of information desired about the error (various selectors are
  633. listed below). The desiredType indicates the data type of the result
  634. desired for that selector.
  635. Errors:
  636. badComponentInstance invalid scripting component instance
  637. errOSASystemError
  638. errOSABadSelector: selector not supported by scripting component
  639. errAECoercionFail: desiredType not supported by scripting component
  640. */
  641. /* OSAScriptError selectors: */
  642. /*
  643. This selector is used to determine the error number of a script error.
  644. These error numbers may be either system error numbers, or error numbers
  645. that are scripting component specific.
  646. Required desiredTypes:
  647. typeShortInteger
  648. */
  649. enum {
  650. kOSAErrorNumber = keyErrorNumber
  651. };
  652. /*
  653. This selector is used to determine the full error message associated
  654. with the error number. It should include the name of the application
  655. which caused the error, as well as the specific error that occurred.
  656. This selector is sufficient for simple error reporting (but see
  657. kOSAErrorBriefMessage, below).
  658. Required desiredTypes:
  659. typeChar error message string
  660. */
  661. enum {
  662. kOSAErrorMessage = keyErrorString
  663. };
  664. /*
  665. This selector is used to determine a brief error message associated with
  666. the error number. This message and should not mention the name of the
  667. application which caused the error, any partial results or offending
  668. object (see kOSAErrorApp, kOSAErrorPartialResult and
  669. kOSAErrorOffendingObject, below).
  670. Required desiredTypes:
  671. typeChar brief error message string
  672. */
  673. /* 0x65727262 */
  674. enum {
  675. kOSAErrorBriefMessage = FOUR_CHAR_CODE('errb')
  676. };
  677. /*
  678. This selector is used to determine which application actually got the
  679. error (if it was the result of an AESend), or the current application
  680. if ....
  681. Required desiredTypes:
  682. typeProcessSerialNumber PSN of the errant application
  683. typeChar name of the errant application
  684. */
  685. /* 0x65726170 */
  686. enum {
  687. kOSAErrorApp = FOUR_CHAR_CODE('erap')
  688. };
  689. /*
  690. This selector is used to determine any partial result returned by an
  691. operation. If an AESend call failed, but a partial result was returned,
  692. then the partial result may be returned as an AEDesc.
  693. Required desiredTypes:
  694. typeBest AEDesc of any partial result
  695. */
  696. /* 0x70746c72 */
  697. enum {
  698. kOSAErrorPartialResult = FOUR_CHAR_CODE('ptlr')
  699. };
  700. /*
  701. This selector is used to determine any object which caused the error
  702. that may have been indicated by an application. The result is an
  703. AEDesc.
  704. Required desiredTypes:
  705. typeBest AEDesc of any offending object
  706. */
  707. /* 0x65726f62 */
  708. enum {
  709. kOSAErrorOffendingObject = FOUR_CHAR_CODE('erob')
  710. };
  711. /*
  712. This selector is used to determine the type expected by a coercion
  713. operation if a type error occurred.
  714. */
  715. /* 0x65727274 */
  716. enum {
  717. kOSAErrorExpectedType = FOUR_CHAR_CODE('errt')
  718. };
  719. /*
  720. This selector is used to determine the source text range (start and
  721. end positions) of where the error occurred.
  722. Required desiredTypes:
  723. typeOSAErrorRange
  724. */
  725. /* 0x65726e67 */
  726. enum {
  727. kOSAErrorRange = FOUR_CHAR_CODE('erng')
  728. };
  729. /*
  730. An AERecord type containing keyOSASourceStart and keyOSASourceEnd fields
  731. of type short.
  732. */
  733. /* 0x65726e67 */
  734. enum {
  735. typeOSAErrorRange = FOUR_CHAR_CODE('erng')
  736. };
  737. /* Field of a typeOSAErrorRange record of typeShortInteger */
  738. /* 0x73726373 */
  739. enum {
  740. keyOSASourceStart = FOUR_CHAR_CODE('srcs')
  741. };
  742. /* Field of a typeOSAErrorRange record of typeShortInteger */
  743. /* 0x73726365 */
  744. enum {
  745. keyOSASourceEnd = FOUR_CHAR_CODE('srce')
  746. };
  747. /* Disposing Script IDs: */
  748. /*
  749. * OSADispose()
  750. *
  751. * Availability:
  752. * Non-Carbon CFM: in AppleScriptLib 1.1 and later
  753. * CarbonLib: in CarbonLib 1.0 and later
  754. * Mac OS X: in version 10.0 and later
  755. */
  756. EXTERN_API( OSAError )
  757. OSADispose(
  758. ComponentInstance scriptingComponent,
  759. OSAID scriptID) FIVEWORDINLINE(0x2F3C, 0x0004, 0x0006, 0x7000, 0xA82A);
  760. /*
  761. OSAComponentFunctionInline(kOSASelectDispose, 4);
  762. Disposes a script or context.
  763. Errors:
  764. badComponentInstance invalid scripting component instance
  765. errOSASystemError
  766. errOSAInvalidID
  767. */
  768. /* Getting and Setting Script Information: */
  769. /*
  770. * OSASetScriptInfo()
  771. *
  772. * Availability:
  773. * Non-Carbon CFM: in AppleScriptLib 1.1 and later
  774. * CarbonLib: in CarbonLib 1.0 and later
  775. * Mac OS X: in version 10.0 and later
  776. */
  777. EXTERN_API( OSAError )
  778. OSASetScriptInfo(
  779. ComponentInstance scriptingComponent,
  780. OSAID scriptID,
  781. OSType selector,
  782. long value) FIVEWORDINLINE(0x2F3C, 0x000C, 0x0007, 0x7000, 0xA82A);
  783. /*
  784. OSAComponentFunctionInline(kOSASelectSetScriptInfo, 12);
  785. Errors:
  786. badComponentInstance invalid scripting component instance
  787. errOSASystemError
  788. errOSAInvalidID
  789. errOSABadSelector: selector not supported by scripting component
  790. or selector not for this scriptID
  791. */
  792. /*
  793. * OSAGetScriptInfo()
  794. *
  795. * Availability:
  796. * Non-Carbon CFM: in AppleScriptLib 1.1 and later
  797. * CarbonLib: in CarbonLib 1.0 and later
  798. * Mac OS X: in version 10.0 and later
  799. */
  800. EXTERN_API( OSAError )
  801. OSAGetScriptInfo(
  802. ComponentInstance scriptingComponent,
  803. OSAID scriptID,
  804. OSType selector,
  805. long * result) FIVEWORDINLINE(0x2F3C, 0x000C, 0x0008, 0x7000, 0xA82A);
  806. /*
  807. OSAComponentFunctionInline(kOSASelectGetScriptInfo, 12);
  808. Errors:
  809. badComponentInstance invalid scripting component instance
  810. errOSASystemError
  811. errOSAInvalidID
  812. errOSABadSelector: selector not supported by scripting component
  813. or selector not for this scriptID
  814. */
  815. /* Manipulating the ActiveProc:
  816. Scripting systems will supply default values for these procedures if they
  817. are not set by the client:
  818. */
  819. typedef CALLBACK_API( OSErr , OSAActiveProcPtr )(long refCon);
  820. typedef STACK_UPP_TYPE(OSAActiveProcPtr) OSAActiveUPP;
  821. /*
  822. * NewOSAActiveUPP()
  823. *
  824. * Availability:
  825. * Non-Carbon CFM: available as macro/inline
  826. * CarbonLib: in CarbonLib 1.0 and later
  827. * Mac OS X: in version 10.0 and later
  828. */
  829. EXTERN_API_C( OSAActiveUPP )
  830. NewOSAActiveUPP(OSAActiveProcPtr userRoutine);
  831. #if !OPAQUE_UPP_TYPES
  832. enum { uppOSAActiveProcInfo = 0x000000E0 }; /* pascal 2_bytes Func(4_bytes) */
  833. #ifdef __cplusplus
  834. inline DEFINE_API_C(OSAActiveUPP) NewOSAActiveUPP(OSAActiveProcPtr userRoutine) { return (OSAActiveUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppOSAActiveProcInfo, GetCurrentArchitecture()); }
  835. #else
  836. #define NewOSAActiveUPP(userRoutine) (OSAActiveUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppOSAActiveProcInfo, GetCurrentArchitecture())
  837. #endif
  838. #endif
  839. /*
  840. * DisposeOSAActiveUPP()
  841. *
  842. * Availability:
  843. * Non-Carbon CFM: available as macro/inline
  844. * CarbonLib: in CarbonLib 1.0 and later
  845. * Mac OS X: in version 10.0 and later
  846. */
  847. EXTERN_API_C( void )
  848. DisposeOSAActiveUPP(OSAActiveUPP userUPP);
  849. #if !OPAQUE_UPP_TYPES
  850. #ifdef __cplusplus
  851. inline DEFINE_API_C(void) DisposeOSAActiveUPP(OSAActiveUPP userUPP) { DisposeRoutineDescriptor((UniversalProcPtr)userUPP); }
  852. #else
  853. #define DisposeOSAActiveUPP(userUPP) DisposeRoutineDescriptor(userUPP)
  854. #endif
  855. #endif
  856. /*
  857. * InvokeOSAActiveUPP()
  858. *
  859. * Availability:
  860. * Non-Carbon CFM: available as macro/inline
  861. * CarbonLib: in CarbonLib 1.0 and later
  862. * Mac OS X: in version 10.0 and later
  863. */
  864. EXTERN_API_C( OSErr )
  865. InvokeOSAActiveUPP(
  866. long refCon,
  867. OSAActiveUPP userUPP);
  868. #if !OPAQUE_UPP_TYPES
  869. #ifdef __cplusplus
  870. inline DEFINE_API_C(OSErr) InvokeOSAActiveUPP(long refCon, OSAActiveUPP userUPP) { return (OSErr)CALL_ONE_PARAMETER_UPP(userUPP, uppOSAActiveProcInfo, refCon); }
  871. #else
  872. #define InvokeOSAActiveUPP(refCon, userUPP) (OSErr)CALL_ONE_PARAMETER_UPP((userUPP), uppOSAActiveProcInfo, (refCon))
  873. #endif
  874. #endif
  875. #if CALL_NOT_IN_CARBON || OLDROUTINENAMES
  876. /* support for pre-Carbon UPP routines: New...Proc and Call...Proc */
  877. #define NewOSAActiveProc(userRoutine) NewOSAActiveUPP(userRoutine)
  878. #define CallOSAActiveProc(userRoutine, refCon) InvokeOSAActiveUPP(refCon, userRoutine)
  879. #endif /* CALL_NOT_IN_CARBON */
  880. /*
  881. * OSASetActiveProc()
  882. *
  883. * Availability:
  884. * Non-Carbon CFM: in AppleScriptLib 1.1 and later
  885. * CarbonLib: in CarbonLib 1.0 and later
  886. * Mac OS X: in version 10.0 and later
  887. */
  888. EXTERN_API( OSAError )
  889. OSASetActiveProc(
  890. ComponentInstance scriptingComponent,
  891. OSAActiveUPP activeProc,
  892. long refCon) FIVEWORDINLINE(0x2F3C, 0x0008, 0x0009, 0x7000, 0xA82A);
  893. /*
  894. OSAComponentFunctionInline(kOSASelectSetActiveProc, 8);
  895. If activeProc is nil, the default activeProc is used.
  896. Errors:
  897. badComponentInstance invalid scripting component instance
  898. errOSASystemError
  899. */
  900. /*
  901. * OSAGetActiveProc()
  902. *
  903. * Availability:
  904. * Non-Carbon CFM: in AppleScriptLib 1.1 and later
  905. * CarbonLib: in CarbonLib 1.0 and later
  906. * Mac OS X: in version 10.0 and later
  907. */
  908. EXTERN_API( OSAError )
  909. OSAGetActiveProc(
  910. ComponentInstance scriptingComponent,
  911. OSAActiveUPP * activeProc,
  912. long * refCon) FIVEWORDINLINE(0x2F3C, 0x0008, 0x000A, 0x7000, 0xA82A);
  913. /*
  914. OSAComponentFunctionInline(kOSASelectGetActiveProc, 8);
  915. Errors:
  916. badComponentInstance invalid scripting component instance
  917. errOSASystemError
  918. */
  919. /**************************************************************************
  920. OSA Optional Compiling Interface
  921. **************************************************************************
  922. Scripting components that support the Compiling interface have the
  923. kOSASupportsCompiling bit set in it's ComponentDescription.
  924. **************************************************************************/
  925. /*
  926. * OSAScriptingComponentName()
  927. *
  928. * Availability:
  929. * Non-Carbon CFM: in AppleScriptLib 1.1 and later
  930. * CarbonLib: in CarbonLib 1.0 and later
  931. * Mac OS X: in version 10.0 and later
  932. */
  933. EXTERN_API( OSAError )
  934. OSAScriptingComponentName(
  935. ComponentInstance scriptingComponent,
  936. AEDesc * resultingScriptingComponentName) FIVEWORDINLINE(0x2F3C, 0x0004, 0x0102, 0x7000, 0xA82A);
  937. /*
  938. OSAComponentFunctionInline(kOSASelectScriptingComponentName, 4);
  939. Given a scripting component, this routine returns the name of that
  940. scripting component in a type that is coercable to text (typeChar).
  941. The generic scripting component returns the name of the default
  942. scripting component. This name should be sufficient to convey to the
  943. user the kind of script (syntax) he is expected to write.
  944. Errors:
  945. badComponentInstance invalid scripting component instance
  946. errOSASystemError
  947. */
  948. /*
  949. * OSACompile()
  950. *
  951. * Availability:
  952. * Non-Carbon CFM: in AppleScriptLib 1.1 and later
  953. * CarbonLib: in CarbonLib 1.0 and later
  954. * Mac OS X: in version 10.0 and later
  955. */
  956. EXTERN_API( OSAError )
  957. OSACompile(
  958. ComponentInstance scriptingComponent,
  959. const AEDesc * sourceData,
  960. long modeFlags,
  961. OSAID * previousAndResultingScriptID) FIVEWORDINLINE(0x2F3C, 0x000C, 0x0103, 0x7000, 0xA82A);
  962. /*
  963. OSAComponentFunctionInline(kOSASelectCompile, 12);
  964. Coerces input desc (possibly text) into a script's internal format.
  965. Once compiled, the script is ready to run. The modeFlags convey
  966. scripting component specific information. The previous script ID
  967. (result parameter) is made to refer to the newly compiled script,
  968. unless it was originally kOSANullScript. In this case a new script
  969. ID is created and used.
  970. Errors:
  971. badComponentInstance invalid scripting component instance
  972. errOSASystemError
  973. errAECoercionFail: sourceData is not compilable
  974. errOSAScriptError: sourceData was a bad script (syntax error)
  975. errOSAInvalidID: previousAndResultingCompiledScriptID was not
  976. valid on input
  977. ModeFlags:
  978. kOSAModePreventGetSource
  979. kOSAModeCompileIntoContext
  980. kOSAModeAugmentContext
  981. kOSAModeNeverInteract
  982. kOSAModeCanInteract
  983. kOSAModeAlwaysInteract
  984. kOSAModeCantSwitchLayer
  985. kOSAModeDontReconnect
  986. kOSAModeDoRecord
  987. */
  988. /*
  989. * OSACopyID()
  990. *
  991. * Availability:
  992. * Non-Carbon CFM: in AppleScriptLib 1.1 and later
  993. * CarbonLib: in CarbonLib 1.0 and later
  994. * Mac OS X: in version 10.0 and later
  995. */
  996. EXTERN_API( OSAError )
  997. OSACopyID(
  998. ComponentInstance scriptingComponent,
  999. OSAID fromID,
  1000. OSAID * toID) FIVEWORDINLINE(0x2F3C, 0x0008, 0x0104, 0x7000, 0xA82A);
  1001. /*
  1002. OSAComponentFunctionInline(kOSASelectCopyID, 8);
  1003. If toID is a reference to kOSANullScript then it is updated to have a
  1004. new scriptID value. This call can be used to perform undo or revert
  1005. operations on scripts.
  1006. Errors:
  1007. badComponentInstance invalid scripting component instance
  1008. errOSASystemError
  1009. errOSAInvalidID
  1010. */
  1011. /**************************************************************************
  1012. OSA Optional GetSource Interface
  1013. **************************************************************************
  1014. Scripting components that support the GetSource interface have the
  1015. kOSASupportsGetSource bit set in their ComponentDescription.
  1016. **************************************************************************/
  1017. /*
  1018. * OSAGetSource()
  1019. *
  1020. * Availability:
  1021. * Non-Carbon CFM: in AppleScriptLib 1.1 and later
  1022. * CarbonLib: in CarbonLib 1.0 and later
  1023. * Mac OS X: in version 10.0 and later
  1024. */
  1025. EXTERN_API( OSAError )
  1026. OSAGetSource(
  1027. ComponentInstance scriptingComponent,
  1028. OSAID scriptID,
  1029. DescType desiredType,
  1030. AEDesc * resultingSourceData) FIVEWORDINLINE(0x2F3C, 0x000C, 0x0201, 0x7000, 0xA82A);
  1031. /*
  1032. OSAComponentFunctionInline(kOSASelectGetSource, 12);
  1033. This routine causes a compiled script to be output in a form (possibly
  1034. text) such that it is suitable to be passed back to OSACompile.
  1035. Errors:
  1036. badComponentInstance invalid scripting component instance
  1037. errOSASystemError
  1038. errOSAInvalidID
  1039. errOSASourceNotAvailable can't get source for this scriptID
  1040. */
  1041. /**************************************************************************
  1042. OSA Optional AECoercion Interface
  1043. **************************************************************************
  1044. Scripting components that support the AECoercion interface have the
  1045. kOSASupportsAECoercion bit set in their ComponentDescription.
  1046. **************************************************************************/
  1047. /*
  1048. * OSACoerceFromDesc()
  1049. *
  1050. * Availability:
  1051. * Non-Carbon CFM: in AppleScriptLib 1.1 and later
  1052. * CarbonLib: in CarbonLib 1.0 and later
  1053. * Mac OS X: in version 10.0 and later
  1054. */
  1055. EXTERN_API( OSAError )
  1056. OSACoerceFromDesc(
  1057. ComponentInstance scriptingComponent,
  1058. const AEDesc * scriptData,
  1059. long modeFlags,
  1060. OSAID * resultingScriptID) FIVEWORDINLINE(0x2F3C, 0x000C, 0x0301, 0x7000, 0xA82A);
  1061. /*
  1062. OSAComponentFunctionInline(kOSASelectCoerceFromDesc, 12);
  1063. This routine causes script data to be coerced into a script value.
  1064. If the scriptData is an AppleEvent, then the resultingScriptID is a
  1065. compiled script ID (mode flags for OSACompile may be used in this case).
  1066. Other scriptData descriptors create script value IDs.
  1067. Errors:
  1068. badComponentInstance invalid scripting component instance
  1069. errOSASystemError
  1070. ModeFlags:
  1071. kOSAModePreventGetSource
  1072. kOSAModeCompileIntoContext
  1073. kOSAModeNeverInteract
  1074. kOSAModeCanInteract
  1075. kOSAModeAlwaysInteract
  1076. kOSAModeCantSwitchLayer
  1077. kOSAModeDontReconnect
  1078. kOSAModeDoRecord
  1079. */
  1080. /*
  1081. * OSACoerceToDesc()
  1082. *
  1083. * Availability:
  1084. * Non-Carbon CFM: in AppleScriptLib 1.1 and later
  1085. * CarbonLib: in CarbonLib 1.0 and later
  1086. * Mac OS X: in version 10.0 and later
  1087. */
  1088. EXTERN_API( OSAError )
  1089. OSACoerceToDesc(
  1090. ComponentInstance scriptingComponent,
  1091. OSAID scriptID,
  1092. DescType desiredType,
  1093. long modeFlags,
  1094. AEDesc * result) FIVEWORDINLINE(0x2F3C, 0x0010, 0x0302, 0x7000, 0xA82A);
  1095. /*
  1096. OSAComponentFunctionInline(kOSASelectCoerceToDesc, 16);
  1097. This routine causes a script value to be coerced into any desired form.
  1098. If the scriptID denotes a compiled script, then it may be coerced to
  1099. typeAppleEvent.
  1100. Errors:
  1101. badComponentInstance invalid scripting component instance
  1102. errOSASystemError
  1103. errOSAInvalidID
  1104. */
  1105. /**************************************************************************
  1106. OSA Optional AESending Interface
  1107. **************************************************************************
  1108. Scripting components that support the AESending interface have the
  1109. kOSASupportsAESending bit set in their ComponentDescription.
  1110. **************************************************************************/
  1111. /*
  1112. Scripting systems will supply default values for these procedures if they
  1113. are not set by the client:
  1114. */
  1115. /*
  1116. * OSASetSendProc()
  1117. *
  1118. * Availability:
  1119. * Non-Carbon CFM: in AppleScriptLib 1.1 and later
  1120. * CarbonLib: in CarbonLib 1.0 and later
  1121. * Mac OS X: in version 10.0 and later
  1122. */
  1123. EXTERN_API( OSAError )
  1124. OSASetSendProc(
  1125. ComponentInstance scriptingComponent,
  1126. OSASendUPP sendProc,
  1127. long refCon) FIVEWORDINLINE(0x2F3C, 0x0008, 0x0401, 0x7000, 0xA82A);
  1128. /*
  1129. OSAComponentFunctionInline(kOSASelectSetSendProc, 8);
  1130. If sendProc is nil, the default sendProc is used.
  1131. Errors:
  1132. badComponentInstance invalid scripting component instance
  1133. errOSASystemError
  1134. */
  1135. /*
  1136. * OSAGetSendProc()
  1137. *
  1138. * Availability:
  1139. * Non-Carbon CFM: in AppleScriptLib 1.1 and later
  1140. * CarbonLib: in CarbonLib 1.0 and later
  1141. * Mac OS X: in version 10.0 and later
  1142. */
  1143. EXTERN_API( OSAError )
  1144. OSAGetSendProc(
  1145. ComponentInstance scriptingComponent,
  1146. OSASendUPP * sendProc,
  1147. long * refCon) FIVEWORDINLINE(0x2F3C, 0x0008, 0x0402, 0x7000, 0xA82A);
  1148. /*
  1149. OSAComponentFunctionInline(kOSASelectGetSendProc, 8);
  1150. Errors:
  1151. badComponentInstance invalid scripting component instance
  1152. errOSASystemError
  1153. */
  1154. /*
  1155. * OSASetCreateProc()
  1156. *
  1157. * Availability:
  1158. * Non-Carbon CFM: in AppleScriptLib 1.1 and later
  1159. * CarbonLib: in CarbonLib 1.0 and later
  1160. * Mac OS X: in version 10.0 and later
  1161. */
  1162. EXTERN_API( OSAError )
  1163. OSASetCreateProc(
  1164. ComponentInstance scriptingComponent,
  1165. OSACreateAppleEventUPP createProc,
  1166. long refCon) FIVEWORDINLINE(0x2F3C, 0x0008, 0x0403, 0x7000, 0xA82A);
  1167. /*
  1168. OSAComponentFunctionInline(kOSASelectSetCreateProc, 8);
  1169. If createProc is nil, the default createProc is used.
  1170. Errors:
  1171. badComponentInstance invalid scripting component instance
  1172. errOSASystemError
  1173. */
  1174. /*
  1175. * OSAGetCreateProc()
  1176. *
  1177. * Availability:
  1178. * Non-Carbon CFM: in AppleScriptLib 1.1 and later
  1179. * CarbonLib: in CarbonLib 1.0 and later
  1180. * Mac OS X: in version 10.0 and later
  1181. */
  1182. EXTERN_API( OSAError )
  1183. OSAGetCreateProc(
  1184. ComponentInstance scriptingComponent,
  1185. OSACreateAppleEventUPP * createProc,
  1186. long * refCon) FIVEWORDINLINE(0x2F3C, 0x0008, 0x0404, 0x7000, 0xA82A);
  1187. /*
  1188. OSAComponentFunctionInline(kOSASelectGetCreateProc, 8);
  1189. Errors:
  1190. badComponentInstance invalid scripting component instance
  1191. errOSASystemError
  1192. */
  1193. /*
  1194. * OSASetDefaultTarget()
  1195. *
  1196. * Availability:
  1197. * Non-Carbon CFM: in AppleScriptLib 1.1 and later
  1198. * CarbonLib: in CarbonLib 1.0 and later
  1199. * Mac OS X: in version 10.0 and later
  1200. */
  1201. EXTERN_API( OSAError )
  1202. OSASetDefaultTarget(
  1203. ComponentInstance scriptingComponent,
  1204. const AEAddressDesc * target) FIVEWORDINLINE(0x2F3C, 0x0004, 0x0405, 0x7000, 0xA82A);
  1205. /*
  1206. OSAComponentFunctionInline(kOSASelectSetDefaultTarget, 4);
  1207. This routine sets the default target application for AE sending.
  1208. It also establishes the default target from which terminologies come.
  1209. It is effectively like having an AppleScript "tell" statement around
  1210. the entire program. If this routine is not called, or if the target
  1211. is a null AEDesc, then the current application is the default target.
  1212. Errors:
  1213. badComponentInstance invalid scripting component instance
  1214. errOSASystemError
  1215. */
  1216. /**************************************************************************
  1217. OSA Optional Recording Interface
  1218. **************************************************************************
  1219. Scripting components that support the Recording interface have the
  1220. kOSASupportsRecording bit set in their ComponentDescription.
  1221. **************************************************************************/
  1222. /*
  1223. * OSAStartRecording()
  1224. *
  1225. * Availability:
  1226. * Non-Carbon CFM: in AppleScriptLib 1.1 and later
  1227. * CarbonLib: in CarbonLib 1.0 and later
  1228. * Mac OS X: in version 10.0 and later
  1229. */
  1230. EXTERN_API( OSAError )
  1231. OSAStartRecording(
  1232. ComponentInstance scriptingComponent,
  1233. OSAID * compiledScriptToModifyID) FIVEWORDINLINE(0x2F3C, 0x0004, 0x0501, 0x7000, 0xA82A);
  1234. /*
  1235. OSAComponentFunctionInline(kOSASelectStartRecording, 4);
  1236. Starts recording. If compiledScriptToModifyID is kOSANullScript, a
  1237. new script ID is created and returned. If the current application has
  1238. a handler for the kOSARecordedText event, then kOSARecordedText events
  1239. are sent to the application containing the text of each AppleEvent
  1240. recorded.
  1241. Errors:
  1242. badComponentInstance invalid scripting component instance
  1243. errOSASystemError
  1244. errOSAInvalidID
  1245. errOSARecordingIsAlreadyOn
  1246. */
  1247. /*
  1248. * OSAStopRecording()
  1249. *
  1250. * Availability:
  1251. * Non-Carbon CFM: in AppleScriptLib 1.1 and later
  1252. * CarbonLib: in CarbonLib 1.0 and later
  1253. * Mac OS X: in version 10.0 and later
  1254. */
  1255. EXTERN_API( OSAError )
  1256. OSAStopRecording(
  1257. ComponentInstance scriptingComponent,
  1258. OSAID compiledScriptID) FIVEWORDINLINE(0x2F3C, 0x0004, 0x0502, 0x7000, 0xA82A);
  1259. /*
  1260. OSAComponentFunctionInline(kOSASelectStopRecording, 4);
  1261. If compiledScriptID is not being recorded into or recording is not
  1262. currently on, no error is returned.
  1263. Errors:
  1264. badComponentInstance invalid scripting component instance
  1265. errOSASystemError
  1266. errOSAInvalidID
  1267. */
  1268. /**************************************************************************
  1269. OSA Optional Convenience Interface
  1270. **************************************************************************
  1271. Scripting components that support the Convenience interface have the
  1272. kOSASupportsConvenience bit set in their ComponentDescription.
  1273. **************************************************************************/
  1274. /*
  1275. * OSALoadExecute()
  1276. *
  1277. * Availability:
  1278. * Non-Carbon CFM: in AppleScriptLib 1.1 and later
  1279. * CarbonLib: in CarbonLib 1.0 and later
  1280. * Mac OS X: in version 10.0 and later
  1281. */
  1282. EXTERN_API( OSAError )
  1283. OSALoadExecute(
  1284. ComponentInstance scriptingComponent,
  1285. const AEDesc * scriptData,
  1286. OSAID contextID,
  1287. long modeFlags,
  1288. OSAID * resultingScriptValueID) FIVEWORDINLINE(0x2F3C, 0x0010, 0x0601, 0x7000, 0xA82A);
  1289. /*
  1290. OSAComponentFunctionInline(kOSASelectLoadExecute, 16);
  1291. This routine is effectively equivalent to calling OSALoad followed by
  1292. OSAExecute. After execution, the compiled source is disposed. Only the
  1293. resulting value ID is retained.
  1294. Errors:
  1295. badComponentInstance invalid scripting component instance
  1296. errOSASystemError
  1297. errOSABadStorageType: scriptData not for this scripting component
  1298. errOSACorruptData: data seems to be corrupt
  1299. errOSADataFormatObsolete script data format is no longer supported
  1300. errOSADataFormatTooNew script data format is from a newer version
  1301. errOSAInvalidID
  1302. errOSAScriptError: the executing script got an error
  1303. ModeFlags:
  1304. kOSAModeNeverInteract
  1305. kOSAModeCanInteract
  1306. kOSAModeAlwaysInteract
  1307. kOSAModeCantSwitchLayer
  1308. kOSAModeDontReconnect
  1309. kOSAModeDoRecord
  1310. */
  1311. /*
  1312. * OSACompileExecute()
  1313. *
  1314. * Availability:
  1315. * Non-Carbon CFM: in AppleScriptLib 1.1 and later
  1316. * CarbonLib: in CarbonLib 1.0 and later
  1317. * Mac OS X: in version 10.0 and later
  1318. */
  1319. EXTERN_API( OSAError )
  1320. OSACompileExecute(
  1321. ComponentInstance scriptingComponent,
  1322. const AEDesc * sourceData,
  1323. OSAID contextID,
  1324. long modeFlags,
  1325. OSAID * resultingScriptValueID) FIVEWORDINLINE(0x2F3C, 0x0010, 0x0602, 0x7000, 0xA82A);
  1326. /*
  1327. OSAComponentFunctionInline(kOSASelectCompileExecute, 16);
  1328. This routine is effectively equivalent to calling OSACompile followed by
  1329. OSAExecute. After execution, the compiled source is disposed. Only the
  1330. resulting value ID is retained.
  1331. Errors:
  1332. badComponentInstance invalid scripting component instance
  1333. errOSASystemError
  1334. errAECoercionFail: sourceData is not compilable
  1335. errOSAScriptError: sourceData was a bad script (syntax error)
  1336. errOSAInvalidID: previousAndResultingCompiledScriptID was not
  1337. valid on input
  1338. errOSAScriptError: the executing script got an error
  1339. ModeFlags:
  1340. kOSAModeNeverInteract
  1341. kOSAModeCanInteract
  1342. kOSAModeAlwaysInteract
  1343. kOSAModeCantSwitchLayer
  1344. kOSAModeDontReconnect
  1345. kOSAModeDoRecord
  1346. */
  1347. /*
  1348. * OSADoScript()
  1349. *
  1350. * Availability:
  1351. * Non-Carbon CFM: in AppleScriptLib 1.1 and later
  1352. * CarbonLib: in CarbonLib 1.0 and later
  1353. * Mac OS X: in version 10.0 and later
  1354. */
  1355. EXTERN_API( OSAError )
  1356. OSADoScript(
  1357. ComponentInstance scriptingComponent,
  1358. const AEDesc * sourceData,
  1359. OSAID contextID,
  1360. DescType desiredType,
  1361. long modeFlags,
  1362. AEDesc * resultingText) FIVEWORDINLINE(0x2F3C, 0x0014, 0x0603, 0x7000, 0xA82A);
  1363. /*
  1364. OSAComponentFunctionInline(kOSASelectDoScript, 20);
  1365. This routine is effectively equivalent to calling OSACompile followed by
  1366. OSAExecute and then OSADisplay. After execution, the compiled source
  1367. and the resulting value are is disposed. Only the resultingText
  1368. descriptor is retained. If a script error occur during processing, the
  1369. resultingText gets the error message of the error, and errOSAScriptError
  1370. is returned. OSAScriptError may still be used to extract more
  1371. information about the particular error.
  1372. Errors:
  1373. badComponentInstance invalid scripting component instance
  1374. errOSASystemError
  1375. errAECoercionFail: sourceData is not compilable or
  1376. desiredType not supported by scripting component
  1377. errOSAScriptError: sourceData was a bad script (syntax error)
  1378. errOSAInvalidID: previousAndResultingCompiledScriptID was not
  1379. valid on input
  1380. errOSAScriptError: the executing script got an error
  1381. ModeFlags:
  1382. kOSAModeNeverInteract
  1383. kOSAModeCanInteract
  1384. kOSAModeAlwaysInteract
  1385. kOSAModeCantSwitchLayer
  1386. kOSAModeDontReconnect
  1387. kOSAModeDoRecord
  1388. kOSAModeDisplayForHumans
  1389. */
  1390. /**************************************************************************
  1391. OSA Optional Dialects Interface
  1392. **************************************************************************
  1393. Scripting components that support the Dialects interface have the
  1394. kOSASupportsDialects bit set in their ComponentDescription.
  1395. **************************************************************************/
  1396. /*
  1397. These calls allows an scripting component that supports different dialects
  1398. to dynamically switch between those dialects. Although this interface is
  1399. specified, the particular dialect codes are scripting component dependent.
  1400. */
  1401. /*
  1402. * OSASetCurrentDialect()
  1403. *
  1404. * Availability:
  1405. * Non-Carbon CFM: in AppleScriptLib 1.1 and later
  1406. * CarbonLib: in CarbonLib 1.0 and later
  1407. * Mac OS X: in version 10.0 and later
  1408. */
  1409. EXTERN_API( OSAError )
  1410. OSASetCurrentDialect(
  1411. ComponentInstance scriptingComponent,
  1412. short dialectCode) FIVEWORDINLINE(0x2F3C, 0x0002, 0x0701, 0x7000, 0xA82A);
  1413. /*
  1414. OSAComponentFunctionInline(kOSASelectSetCurrentDialect, 2);
  1415. Errors:
  1416. badComponentInstance invalid scripting component instance
  1417. errOSASystemError
  1418. errOSANoSuchDialect: invalid dialectCode
  1419. */
  1420. /*
  1421. * OSAGetCurrentDialect()
  1422. *
  1423. * Availability:
  1424. * Non-Carbon CFM: in AppleScriptLib 1.1 and later
  1425. * CarbonLib: in CarbonLib 1.0 and later
  1426. * Mac OS X: in version 10.0 and later
  1427. */
  1428. EXTERN_API( OSAError )
  1429. OSAGetCurrentDialect(
  1430. ComponentInstance scriptingComponent,
  1431. short * resultingDialectCode) FIVEWORDINLINE(0x2F3C, 0x0004, 0x0702, 0x7000, 0xA82A);
  1432. /*
  1433. OSAComponentFunctionInline(kOSASelectGetCurrentDialect, 4);
  1434. Errors:
  1435. badComponentInstance invalid scripting component instance
  1436. errOSASystemError
  1437. */
  1438. /*
  1439. * OSAAvailableDialects()
  1440. *
  1441. * Availability:
  1442. * Non-Carbon CFM: in AppleScriptLib 1.1 and later
  1443. * CarbonLib: in CarbonLib 1.0 and later
  1444. * Mac OS X: in version 10.0 and later
  1445. */
  1446. EXTERN_API( OSAError )
  1447. OSAAvailableDialects(
  1448. ComponentInstance scriptingComponent,
  1449. AEDesc * resultingDialectInfoList) FIVEWORDINLINE(0x2F3C, 0x0004, 0x0703, 0x7000, 0xA82A);
  1450. /*
  1451. OSAComponentFunctionInline(kOSASelectAvailableDialects, 4);
  1452. This call return an AEList containing information about each of the
  1453. currently available dialects of a scripting component. Each item
  1454. is an AERecord of typeOSADialectInfo that contains at least the fields
  1455. keyOSADialectName, keyOSADialectCode, KeyOSADialectLangCode and
  1456. keyOSADialectScriptCode.
  1457. Errors:
  1458. badComponentInstance invalid scripting component instance
  1459. errOSASystemError
  1460. */
  1461. /*
  1462. * OSAGetDialectInfo()
  1463. *
  1464. * Availability:
  1465. * Non-Carbon CFM: in AppleScriptLib 1.1 and later
  1466. * CarbonLib: in CarbonLib 1.0 and later
  1467. * Mac OS X: in version 10.0 and later
  1468. */
  1469. EXTERN_API( OSAError )
  1470. OSAGetDialectInfo(
  1471. ComponentInstance scriptingComponent,
  1472. short dialectCode,
  1473. OSType selector,
  1474. AEDesc * resultingDialectInfo) FIVEWORDINLINE(0x2F3C, 0x000A, 0x0704, 0x7000, 0xA82A);
  1475. /*
  1476. OSAComponentFunctionInline(kOSASelectGetDialectInfo, 10);
  1477. This call gives information about the specified dialect of a scripting
  1478. component. It returns an AEDesc whose type depends on the selector
  1479. specified. Available selectors are the same as the field keys for a
  1480. dialect info record. The type of AEDesc returned is the same as the
  1481. type of the field that has same key as the selector.
  1482. Errors:
  1483. badComponentInstance invalid scripting component instance
  1484. errOSASystemError
  1485. errOSABadSelector
  1486. errOSANoSuchDialect: invalid dialectCode
  1487. */
  1488. /*
  1489. * OSAAvailableDialectCodeList()
  1490. *
  1491. * Availability:
  1492. * Non-Carbon CFM: in AppleScriptLib 1.1 and later
  1493. * CarbonLib: in CarbonLib 1.0 and later
  1494. * Mac OS X: in version 10.0 and later
  1495. */
  1496. EXTERN_API( OSAError )
  1497. OSAAvailableDialectCodeList(
  1498. ComponentInstance scriptingComponent,
  1499. AEDesc * resultingDialectCodeList) FIVEWORDINLINE(0x2F3C, 0x0004, 0x0705, 0x7000, 0xA82A);
  1500. /*
  1501. OSAComponentFunctionInline(kOSASelectAvailableDialectCodeList, 4);
  1502. This is alternative to OSAGetAvailableDialectCodeList. Use this call
  1503. and OSAGetDialectInfo to get information on dialects.
  1504. This call return an AEList containing dialect code for each of the
  1505. currently available dialects of a scripting component. Each dialect
  1506. code is a short integer of type typeShortInteger.
  1507. Errors:
  1508. badComponentInstance invalid scripting component instance
  1509. errOSASystemError
  1510. Type of a dialect info record containing at least keyOSADialectName
  1511. and keyOSADialectCode fields.
  1512. keys for dialect info record, also used as selectors to OSAGetDialectInfo.
  1513. Field of a typeOSADialectInfo record of typeChar.
  1514. Field of a typeOSADialectInfo record of typeShortInteger.
  1515. Field of a typeOSADialectInfo record of typeShortInteger.
  1516. Field of a typeOSADialectInfo record of typeShortInteger.
  1517. */
  1518. /**************************************************************************
  1519. OSA Optional Event Handling Interface
  1520. **************************************************************************
  1521. Scripting components that support the Event Handling interface have the
  1522. kOSASupportsEventHandling bit set in their ComponentDescription.
  1523. **************************************************************************/
  1524. /*
  1525. * OSASetResumeDispatchProc()
  1526. *
  1527. * Availability:
  1528. * Non-Carbon CFM: in AppleScriptLib 1.1 and later
  1529. * CarbonLib: in CarbonLib 1.0 and later
  1530. * Mac OS X: in version 10.0 and later
  1531. */
  1532. EXTERN_API( OSAError )
  1533. OSASetResumeDispatchProc(
  1534. ComponentInstance scriptingComponent,
  1535. AEEventHandlerUPP resumeDispatchProc,
  1536. long refCon) FIVEWORDINLINE(0x2F3C, 0x0008, 0x0801, 0x7000, 0xA82A);
  1537. /*
  1538. OSAComponentFunctionInline(kOSASelectSetResumeDispatchProc, 8);
  1539. This function is used to set the ResumeDispatchProc that will be used
  1540. by OSAExecuteEvent and OSADoEvent if either no event handler can be
  1541. found in the context, or the context event hander "continues" control
  1542. onward. The two constants kOSAUseStandardDispatch and kOSANoDispatch
  1543. may also be passed to this routine indicating that the handler registered
  1544. in the application with AEInstallEventHandler should be used, or no
  1545. dispatch should occur, respectively.
  1546. Errors:
  1547. badComponentInstance invalid scripting component instance
  1548. errOSASystemError
  1549. */
  1550. enum {
  1551. kOSAUseStandardDispatch = kAEUseStandardDispatch
  1552. };
  1553. /*
  1554. Special ResumeDispatchProc constant which may be passed to
  1555. OSASetResumeDispatchProc indicating that the handler registered
  1556. in the application with AEInstallEventHandler should be used.
  1557. NOTE: Had to remove the cast (AEEventHandlerUPP). The C compiler
  1558. doesn't allow pointer types to be assigned to an enum. All
  1559. constants must be assigned as enums to translate properly to
  1560. Pascal.
  1561. */
  1562. enum {
  1563. kOSANoDispatch = kAENoDispatch
  1564. };
  1565. /*
  1566. Special ResumeDispatchProc constant which may be passed to
  1567. OSASetResumeDispatchProc indicating that no dispatch should occur.
  1568. NOTE: Had to remove the cast (AEEventHandlerUPP). The C compiler
  1569. doesn't allow pointer types to be assigned to an enum. All
  1570. constants must be assigned as enums to translate properly to
  1571. Pascal.
  1572. */
  1573. enum {
  1574. kOSADontUsePhac = 0x0001
  1575. };
  1576. /*
  1577. Special refCon constant that may be given to OSASetResumeDispatchProc
  1578. only when kOSAUseStandardDispatch is used as the ResumeDispatchProc.
  1579. This causes the standard dispatch to be performed, except the phac
  1580. handler is not called. This is useful during tinkerability, when
  1581. the phac handler is used to lookup a context associated with an event's
  1582. direct parameter, and call OSAExecuteEvent or OSADoEvent. Failure to
  1583. bypass the phac handler would result in an infinite loop.
  1584. */
  1585. /*
  1586. * OSAGetResumeDispatchProc()
  1587. *
  1588. * Availability:
  1589. * Non-Carbon CFM: in AppleScriptLib 1.1 and later
  1590. * CarbonLib: in CarbonLib 1.0 and later
  1591. * Mac OS X: in version 10.0 and later
  1592. */
  1593. EXTERN_API( OSAError )
  1594. OSAGetResumeDispatchProc(
  1595. ComponentInstance scriptingComponent,
  1596. AEEventHandlerUPP * resumeDispatchProc,
  1597. long * refCon) FIVEWORDINLINE(0x2F3C, 0x0008, 0x0802, 0x7000, 0xA82A);
  1598. /*
  1599. OSAComponentFunctionInline(kOSASelectGetResumeDispatchProc, 8);
  1600. Returns the registered ResumeDispatchProc. If no ResumeDispatchProc has
  1601. been registered, then kOSAUseStandardDispatch (the default) is returned.
  1602. Errors:
  1603. badComponentInstance invalid scripting component instance
  1604. errOSASystemError
  1605. */
  1606. /*
  1607. * OSAExecuteEvent()
  1608. *
  1609. * Availability:
  1610. * Non-Carbon CFM: in AppleScriptLib 1.1 and later
  1611. * CarbonLib: in CarbonLib 1.0 and later
  1612. * Mac OS X: in version 10.0 and later
  1613. */
  1614. EXTERN_API( OSAError )
  1615. OSAExecuteEvent(
  1616. ComponentInstance scriptingComponent,
  1617. const AppleEvent * theAppleEvent,
  1618. OSAID contextID,
  1619. long modeFlags,
  1620. OSAID * resultingScriptValueID) FIVEWORDINLINE(0x2F3C, 0x0010, 0x0803, 0x7000, 0xA82A);
  1621. /*
  1622. OSAComponentFunctionInline(kOSASelectExecuteEvent, 16);
  1623. This call is similar to OSAExecute except the initial command to
  1624. execute comes in the form of an AppleEvent. If the contextID
  1625. defines any event handlers for that event, they are used to process
  1626. the event. If no event handler can be found in the context
  1627. errAEEventNotHandled is returned. If an event handler is found and
  1628. the hander "continues" control onward, the ResumeDispatchProc
  1629. (registered with OSASetResumeDispatchProc, above) is called given the
  1630. AppleEvent. The result is returned as a scriptValueID.
  1631. Errors:
  1632. badComponentInstance invalid scripting component instance
  1633. errOSASystemError
  1634. errOSAInvalidID
  1635. errOSAScriptError: the executing script got an error
  1636. errAEEventNotHandled: no handler for event in contextID
  1637. ModeFlags:
  1638. kOSAModeNeverInteract
  1639. kOSAModeCanInteract
  1640. kOSAModeAlwaysInteract
  1641. kOSAModeCantSwitchLayer
  1642. kOSAModeDontReconnect
  1643. kOSAModeDoRecord
  1644. */
  1645. /*
  1646. * OSADoEvent()
  1647. *
  1648. * Availability:
  1649. * Non-Carbon CFM: in AppleScriptLib 1.1 and later
  1650. * CarbonLib: in CarbonLib 1.0 and later
  1651. * Mac OS X: in version 10.0 and later
  1652. */
  1653. EXTERN_API( OSAError )
  1654. OSADoEvent(
  1655. ComponentInstance scriptingComponent,
  1656. const AppleEvent * theAppleEvent,
  1657. OSAID contextID,
  1658. long modeFlags,
  1659. AppleEvent * reply) FIVEWORDINLINE(0x2F3C, 0x0010, 0x0804, 0x7000, 0xA82A);
  1660. /*
  1661. OSAComponentFunctionInline(kOSASelectDoEvent, 16);
  1662. This call is similar to OSADoScript except the initial command to
  1663. execute comes in the form of an AppleEvent, and the result is an
  1664. AppleEvent reply record. If the contextID defines any event handlers
  1665. for that event, they are used to process the event. If no event handler
  1666. can be found in the context errAEEventNotHandled is returned. If an
  1667. event handler is found and the hander "continues" control onward, the
  1668. ResumeDispatchProc (registered with OSASetResumeDispatchProc, above) is
  1669. called given the AppleEvent. The result is returned in the form of an
  1670. AppleEvent reply descriptor. If at any time the script gets an error, or
  1671. if the ResumeDispatchProc returns a reply event indicating an error,
  1672. then the OSADoEvent call itself returns an error reply (i.e. OSADoEvent
  1673. should never return errOSAScriptError). Any error result returned by
  1674. the ResumeDispatchProc will be returned by OSADoEvent.
  1675. Errors:
  1676. badComponentInstance invalid scripting component instance
  1677. errOSASystemError
  1678. errOSAInvalidID
  1679. errAEEventNotHandled: no handler for event in contextID
  1680. ModeFlags:
  1681. kOSAModeNeverInteract
  1682. kOSAModeCanInteract
  1683. kOSAModeAlwaysInteract
  1684. kOSAModeCantSwitchLayer
  1685. kOSAModeDontReconnect
  1686. kOSAModeDoRecord
  1687. */
  1688. /*
  1689. * OSAMakeContext()
  1690. *
  1691. * Availability:
  1692. * Non-Carbon CFM: in AppleScriptLib 1.1 and later
  1693. * CarbonLib: in CarbonLib 1.0 and later
  1694. * Mac OS X: in version 10.0 and later
  1695. */
  1696. EXTERN_API( OSAError )
  1697. OSAMakeContext(
  1698. ComponentInstance scriptingComponent,
  1699. const AEDesc * contextName,
  1700. OSAID parentContext,
  1701. OSAID * resultingContextID) FIVEWORDINLINE(0x2F3C, 0x000C, 0x0805, 0x7000, 0xA82A);
  1702. /*
  1703. OSAComponentFunctionInline(kOSASelectMakeContext, 12);
  1704. Makes a new empty context which may be passed to OSAExecute or
  1705. OSAExecuteEvent. If contextName is typeNull, an unnamed context is
  1706. created. If parentContext is kOSANullScript then the resulting context
  1707. does not inherit bindings from any other context.
  1708. Errors:
  1709. badComponentInstance invalid scripting component instance
  1710. errOSASystemError
  1711. errOSAInvalidID
  1712. errAECoercionFail: contextName is invalid
  1713. */
  1714. #if PRAGMA_STRUCT_ALIGN
  1715. #pragma options align=reset
  1716. #elif PRAGMA_STRUCT_PACKPUSH
  1717. #pragma pack(pop)
  1718. #elif PRAGMA_STRUCT_PACK
  1719. #pragma pack()
  1720. #endif
  1721. #ifdef PRAGMA_IMPORT_OFF
  1722. #pragma import off
  1723. #elif PRAGMA_IMPORT
  1724. #pragma import reset
  1725. #endif
  1726. #ifdef __cplusplus
  1727. }
  1728. #endif
  1729. #endif /* __OSA__ */