OSA.pas 70 KB

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