macostp.inc 28 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835
  1. {
  2. $Id$
  3. This file is part of the Free Pascal run time library.
  4. Copyright (c) 2003 - 2004 by Olle Raab
  5. A selection of the MacOS API for FreePascal, written
  6. in the Turbo Pascal dialect.
  7. It is primarily for internal use in the rtl, please
  8. do not expect it to remain the same over time,
  9. it will be subject to changes.
  10. See the file COPYING.FPC, included in this distribution,
  11. for details about the copyright.
  12. This program is distributed in the hope that it will be useful,
  13. but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  15. **********************************************************************}
  16. {Note: Types like Mac_XXX corresponds to the type XXX defined
  17. in MacOS Universal Headers. The prefix is to avoid name clashes
  18. with FPC types.}
  19. {$PACKRECORDS 2} {Alignment inherited from the m68k days}
  20. {************** from Types.p ***************}
  21. const
  22. noErr = 0;
  23. type
  24. SignedByte = shortint;
  25. SignedBytePtr = ^SignedByte;
  26. SInt8 = -128..127;
  27. SInt16 = INTEGER;
  28. SInt32 = LONGINT;
  29. UInt8 = 0..255;
  30. UInt16 = WORD;
  31. UInt32 = LONGWORD;
  32. OSErr = Integer;
  33. OSType = Longword;
  34. ResType = Longword;
  35. Mac_Ptr = pointer;
  36. Mac_Handle = ^Mac_Ptr;
  37. Str31 = string[31];
  38. Str32 = string[32];
  39. Str63 = string[63];
  40. Str255 = string[255];
  41. StringPtr = ^Str255;
  42. ProcPtr = Mac_Ptr;
  43. UniversalProcPtr = ProcPtr;
  44. ScriptCode = INTEGER;
  45. LangCode = INTEGER;
  46. Point = record
  47. case INTEGER of
  48. 0: (
  49. v: INTEGER;
  50. h: INTEGER;
  51. );
  52. 1: (
  53. vh: array[0..1] of INTEGER;
  54. );
  55. end;
  56. PointPtr = ^Point;
  57. Rect = record
  58. case INTEGER of
  59. 0: (
  60. top: INTEGER;
  61. left: INTEGER;
  62. bottom: INTEGER;
  63. right: INTEGER;
  64. );
  65. 1: (
  66. topLeft: Point;
  67. botRight: Point;
  68. );
  69. end;
  70. RectPtr = ^Rect;
  71. procedure Debugger;
  72. external 'InterfaceLib';
  73. procedure DebugStr(s: Str255);
  74. external 'InterfaceLib';
  75. {************** from Memory.p ***************}
  76. type
  77. Size = Longint;
  78. function NewHandle (byteCount: Size): Mac_Handle;
  79. external 'InterfaceLib';
  80. function NewPtr(logicalSize: Size): Mac_Ptr ;
  81. external 'InterfaceLib';
  82. procedure DisposePtr (p: Mac_Ptr);
  83. external 'InterfaceLib';
  84. function GetPtrSize (p: Mac_Ptr): Size;
  85. external 'InterfaceLib';
  86. procedure SetPtrSize (p: Mac_Ptr; newSize: Size);
  87. external 'InterfaceLib';
  88. procedure DisposeHandle (h: Mac_Handle);
  89. external 'InterfaceLib';
  90. procedure SetHandleSize (h: Mac_Handle; newSize: Size);
  91. external 'InterfaceLib';
  92. function GetHandleSize (h: Mac_Handle): Size;
  93. external 'InterfaceLib';
  94. function Mac_FreeMem: Longint;
  95. external 'InterfaceLib' name 'FreeMem';
  96. PROCEDURE MaxApplZone;
  97. external 'InterfaceLib';
  98. PROCEDURE HLock(h: Mac_Handle);
  99. external 'InterfaceLib';
  100. PROCEDURE HUnlock(h: Mac_Handle);
  101. external 'InterfaceLib';
  102. function MemError: OSErr;
  103. external 'InterfaceLib';
  104. {************** from GestaltEqu.p ***************}
  105. FUNCTION Gestalt(selector: OSType; VAR response: LONGINT): OSErr;
  106. external 'InterfaceLib' name 'Gestalt';
  107. const
  108. { Gestalt selector and values for the Appearance Manager }
  109. gestaltAliasMgrAttr = 'alis'; { Alias Mgr Attributes }
  110. gestaltAliasMgrPresent = 0; { True if the Alias Mgr is present }
  111. gestaltAliasMgrSupportsRemoteAppletalk = 1; { True if the Alias Mgr knows about Remote Appletalk }
  112. gestaltAliasMgrSupportsAOCEKeychain = 2; { True if the Alias Mgr knows about the AOCE Keychain }
  113. gestaltAliasMgrResolveAliasFileWithMountOptions = 3; { True if the Alias Mgr implements gestaltAliasMgrResolveAliasFileWithMountOptions() and IsAliasFile() }
  114. gestaltAliasMgrFollowsAliasesWhenResolving = 4;
  115. gestaltAliasMgrSupportsExtendedCalls = 5;
  116. gestaltAliasMgrSupportsFSCalls = 6; { true if Alias Mgr supports HFS+ Calls }
  117. gestaltAppearanceAttr = 'appr';
  118. gestaltAppearanceExists = 0;
  119. gestaltAppearanceCompatMode = 1;
  120. { Gestalt selector for determining Appearance Manager version }
  121. { If this selector does not exist, but gestaltAppearanceAttr }
  122. { does, it indicates that the 1.0 version is installed. This }
  123. { gestalt returns a BCD number representing the version of the }
  124. { Appearance Manager that is currently running, e.g. 0x0101 for }
  125. { version 1.0.1. }
  126. gestaltAppearanceVersion = 'apvr';
  127. gestaltCFMAttr = 'cfrg'; { Selector for information about the Code Fragment Manager }
  128. gestaltCFMPresent = 0; { True if the Code Fragment Manager is present }
  129. gestaltCFMPresentMask = $0001;
  130. gestaltCFM99Present = 2; { True if the CFM-99 features are present. }
  131. gestaltCFM99PresentMask = $0004;
  132. gestaltAppleEventsAttr = 'evnt'; { Apple Events attributes }
  133. gestaltAppleEventsPresent = 0; { True if Apple Events present }
  134. gestaltScriptingSupport = 1;
  135. gestaltOSLInSystem = 2; { OSL is in system so donÕt use the one linked in to app }
  136. gestaltFindFolderAttr = 'fold'; { Folder Mgr attributes }
  137. gestaltFindFolderPresent = 0; { True if Folder Mgr present }
  138. gestaltFolderDescSupport = 1; { True if Folder Mgr has FolderDesc calls }
  139. gestaltFolderMgrFollowsAliasesWhenResolving = 2; { True if Folder Mgr follows folder aliases }
  140. gestaltFolderMgrSupportsExtendedCalls = 3; { True if Folder Mgr supports the Extended calls }
  141. gestaltFolderMgrSupportsDomains = 4; { True if Folder Mgr supports domains for the first parameter to FindFolder }
  142. gestaltFolderMgrSupportsFSCalls = 5; { True if FOlder manager supports __FindFolderFSRef & __FindFolderExtendedFSRef }
  143. gestaltFPUType = 'fpu '; { fpu type }
  144. gestaltNoFPU = 0; { no FPU }
  145. gestalt68881 = 1; { 68881 FPU }
  146. gestalt68882 = 2; { 68882 FPU }
  147. gestalt68040FPU = 3; { 68040 built-in FPU }
  148. gestaltFSAttr = 'fs '; { file system attributes }
  149. gestaltFullExtFSDispatching = 0; { has really cool new HFSDispatch dispatcher }
  150. gestaltHasFSSpecCalls = 1; { has FSSpec calls }
  151. gestaltHasFileSystemManager = 2; { has a file system manager }
  152. gestaltFSMDoesDynamicLoad = 3; { file system manager supports dynamic loading }
  153. gestaltFSSupports4GBVols = 4; { file system supports 4 gigabyte volumes }
  154. gestaltFSSupports2TBVols = 5; { file system supports 2 terabyte volumes }
  155. gestaltHasExtendedDiskInit = 6; { has extended Disk Initialization calls }
  156. gestaltDTMgrSupportsFSM = 7; { Desktop Manager support FSM-based foreign file systems }
  157. gestaltFSNoMFSVols = 8; { file system doesn't supports MFS volumes }
  158. gestaltFSSupportsHFSPlusVols = 9; { file system supports HFS Plus volumes }
  159. gestaltFSIncompatibleDFA82 = 10; { VCB and FCB structures changed; DFA 8.2 is incompatible }
  160. gestaltHasHFSPlusAPIs = 12; { file system supports HFS Plus APIs }
  161. gestaltMustUseFCBAccessors = 13; { FCBSPtr and FSFCBLen are invalid - must use FSM FCB accessor functions }
  162. gestaltFSUsesPOSIXPathsForConversion = 14; { The path interchange routines operate on POSIX paths instead of HFS paths }
  163. gestaltOSAttr = 'os '; { o/s attributes }
  164. gestaltSysZoneGrowable = 0; { system heap is growable }
  165. gestaltLaunchCanReturn = 1; { can return from launch }
  166. gestaltLaunchFullFileSpec = 2; { can launch from full file spec }
  167. gestaltLaunchControl = 3; { launch control support available }
  168. gestaltTempMemSupport = 4; { temp memory support }
  169. gestaltRealTempMemory = 5; { temp memory handles are real }
  170. gestaltTempMemTracked = 6; { temporary memory handles are tracked }
  171. gestaltIPCSupport = 7; { IPC support is present }
  172. gestaltSysDebuggerSupport = 8; { system debugger support is present }
  173. gestaltNativeProcessMgrBit = 19; { the process manager itself is native }
  174. gestaltQuickdrawVersion = 'qd '; { quickdraw version }
  175. gestaltOriginalQD = $0000; { original 1-bit QD }
  176. gestalt8BitQD = $0100; { 8-bit color QD }
  177. gestalt32BitQD = $0200; { 32-bit color QD }
  178. gestalt32BitQD11 = $0201; { 32-bit color QDv1.1 }
  179. gestalt32BitQD12 = $0220; { 32-bit color QDv1.2 }
  180. gestalt32BitQD13 = $0230; { 32-bit color QDv1.3 }
  181. gestaltAllegroQD = $0250; { Allegro QD OS 8.5 }
  182. gestaltMacOSXQD = $0300; { Mac OS X QD }
  183. gestaltScriptMgrVersion = 'scri'; { Script Manager version number }
  184. gestaltScriptCount = 'scr#'; { number of active script systems }
  185. gestaltStandardFileAttr = 'stdf'; { Standard File attributes }
  186. gestaltStandardFile58 = 0; { True if selectors 5-8 (StandardPutFile-CustomGetFile) are supported }
  187. gestaltStandardFileTranslationAware = 1; { True if standard file is translation manager aware }
  188. gestaltStandardFileHasColorIcons = 2; { True if standard file has 16x16 color icons }
  189. gestaltStandardFileUseGenericIcons = 3; { Standard file LDEF to use only the system generic icons if true }
  190. gestaltStandardFileHasDynamicVolumeAllocation = 4; { True if standard file supports more than 20 volumes }
  191. gestaltSystemVersion = 'sysv'; { system version }
  192. gestaltThreadMgrAttr = 'thds'; { Thread Manager attributes }
  193. gestaltThreadMgrPresent = 0; { bit true if Thread Mgr is present }
  194. gestaltSpecificMatchSupport = 1; { bit true if Thread Mgr supports exact match creation option }
  195. gestaltThreadsLibraryPresent = 2; { bit true if Thread Mgr shared library is present }
  196. {************** from OSUtils.p ***************}
  197. type
  198. QElemPtr = ^QElem;
  199. QElem = record
  200. qLink: QElemPtr;
  201. qType: INTEGER;
  202. qData: array[0..0] of INTEGER;
  203. end;
  204. CONST
  205. curSysEnvVers = 2; { Updated to equal latest SysEnvirons version }
  206. TYPE
  207. SysEnvRecPtr = ^SysEnvRec;
  208. SysEnvRec = RECORD
  209. environsVersion: INTEGER;
  210. machineType: INTEGER;
  211. systemVersion: INTEGER;
  212. processor: INTEGER;
  213. hasFPU: BOOLEAN;
  214. hasColorQD: BOOLEAN;
  215. keyBoardType: INTEGER;
  216. atDrvrVersNum: INTEGER;
  217. sysVRefNum: INTEGER;
  218. END;
  219. FUNCTION SysEnvirons(versionRequested: INTEGER; VAR theWorld: SysEnvRec): OSErr;
  220. external 'InterfaceLib';
  221. {************** from Finder.p ***************}
  222. type
  223. FInfo = record
  224. fdType: OSType; {the type of the file}
  225. fdCreator: OSType; {file's creator}
  226. fdFlags: INTEGER; {flags ex. hasbundle,invisible,locked, etc.}
  227. fdLocation: Point; {file's location in folder}
  228. fdFldr: INTEGER; {folder containing file}
  229. end;
  230. FXInfo = record
  231. fdIconID: INTEGER; {Icon ID}
  232. fdUnused: array[0..2] of INTEGER; {unused but reserved 6 bytes}
  233. fdScript: SInt8; {Script flag and number}
  234. fdXFlags: SInt8; {More flag bits}
  235. fdComment: INTEGER; {Comment ID}
  236. fdPutAway: LONGINT; {Home Dir ID}
  237. end;
  238. DInfo = record
  239. frRect: Rect; {folder rect}
  240. frFlags: INTEGER; {Flags}
  241. frLocation: Point; {folder location}
  242. frView: INTEGER; {folder view}
  243. end;
  244. DXInfo = record
  245. frScroll: Point; {scroll position}
  246. frOpenChain: LONGINT; {DirID chain of open folders}
  247. frScript: SInt8; {Script flag and number}
  248. frXFlags: SInt8; {More flag bits}
  249. frComment: INTEGER; {comment}
  250. frPutAway: LONGINT; {DirID}
  251. end;
  252. {************** from Files.p ***************}
  253. const
  254. fsAtMark = 0;
  255. fsCurPerm = 0;
  256. fsRdPerm = 1;
  257. fInvisible = 16384;
  258. fsWrPerm = 2;
  259. fsRdWrPerm = 3;
  260. fsRdWrShPerm = 4;
  261. fsFromStart = 1;
  262. fsFromLEOF = 2;
  263. fsFromMark = 3;
  264. rdVerify = 64;
  265. ioMapBuffer = 4;
  266. ioModeReserved = 8;
  267. ioDirFlg = 4; { see IM IV-125 }
  268. ioDirMask = $10;
  269. fsRtParID = 1;
  270. fsRtDirID = 2;
  271. type
  272. CatPositionRecPtr = ^CatPositionRec;
  273. CatPositionRec = RECORD
  274. initialize: LONGINT;
  275. priv: ARRAY [1..6] OF INTEGER;
  276. END;
  277. FSSpec = record
  278. vRefNum: Integer;
  279. parID: Longint;
  280. name: Str63;
  281. end;
  282. FSSpecPtr = ^FSSpec;
  283. IOCompletionUPP = UniversalProcPtr;
  284. CInfoPBRecPtr = ^CInfoPBRec;
  285. CInfoPBRec = record
  286. qLink: QElemPtr;
  287. qType: INTEGER;
  288. ioTrap: INTEGER;
  289. ioCmdAddr: Mac_Ptr;
  290. ioCompletion: IOCompletionUPP;
  291. ioResult: OSErr;
  292. ioNamePtr: StringPtr;
  293. ioVRefNum: INTEGER;
  294. ioFRefNum: INTEGER;
  295. ioFVersNum: SInt8;
  296. filler1: SInt8;
  297. ioFDirIndex: INTEGER;
  298. ioFlAttrib: SInt8;
  299. ioACUser: SInt8;
  300. case INTEGER of
  301. 0: (
  302. ioFlFndrInfo: FInfo;
  303. ioDirID: LONGINT;
  304. ioFlStBlk: INTEGER;
  305. ioFlLgLen: LONGINT;
  306. ioFlPyLen: LONGINT;
  307. ioFlRStBlk: INTEGER;
  308. ioFlRLgLen: LONGINT;
  309. ioFlRPyLen: LONGINT;
  310. ioFlCrDat: LONGINT;
  311. ioFlMdDat: LONGINT;
  312. ioFlBkDat: LONGINT;
  313. ioFlXFndrInfo: FXInfo;
  314. ioFlParID: LONGINT;
  315. ioFlClpSiz: LONGINT;
  316. );
  317. 1: (
  318. ioDrUsrWds: DInfo;
  319. ioDrDirID: LONGINT;
  320. ioDrNmFls: INTEGER;
  321. filler3: array[1..9] of INTEGER;
  322. ioDrCrDat: LONGINT;
  323. ioDrMdDat: LONGINT;
  324. ioDrBkDat: LONGINT;
  325. ioDrFndrInfo: DXInfo;
  326. ioDrParID: LONGINT;
  327. );
  328. end;
  329. CInfoPBPtr = ^CInfoPBRec;
  330. HParamBlockRecPtr = ^HParamBlockRec;
  331. HParamBlockRec = RECORD
  332. qLink: QElemPtr; { queue link in header }
  333. qType: INTEGER; { type byte for safety check }
  334. ioTrap: INTEGER; { FS: the Trap }
  335. ioCmdAddr: pointer; { FS: address to dispatch to }
  336. ioCompletion: IOCompletionUPP; { completion routine addr (0 for synch calls) }
  337. ioResult: OSErr; { result code }
  338. ioNamePtr: StringPtr; { ptr to Vol:FileName string }
  339. ioVRefNum: INTEGER; { volume refnum (DrvNum for Eject and MountVol) }
  340. CASE INTEGER OF
  341. 0: (
  342. ioRefNum: INTEGER;
  343. ioVersNum: SInt8;
  344. ioPermssn: SInt8;
  345. ioMisc: pointer;
  346. ioBuffer: pointer;
  347. ioReqCount: LONGINT;
  348. ioActCount: LONGINT;
  349. ioPosMode: INTEGER;
  350. ioPosOffset: LONGINT;
  351. );
  352. 1: (
  353. ioFRefNum: INTEGER;
  354. ioFVersNum: SInt8;
  355. filler1: SInt8;
  356. ioFDirIndex: INTEGER;
  357. ioFlAttrib: SInt8;
  358. ioFlVersNum: SInt8;
  359. ioFlFndrInfo: FInfo;
  360. ioDirID: LONGINT;
  361. ioFlStBlk: UInt16;
  362. ioFlLgLen: LONGINT;
  363. ioFlPyLen: LONGINT;
  364. ioFlRStBlk: UInt16;
  365. ioFlRLgLen: LONGINT;
  366. ioFlRPyLen: LONGINT;
  367. ioFlCrDat: UInt32;
  368. ioFlMdDat: UInt32;
  369. );
  370. 2: (
  371. filler2: LONGINT;
  372. ioVolIndex: INTEGER;
  373. ioVCrDate: UInt32;
  374. ioVLsMod: UInt32;
  375. ioVAtrb: INTEGER;
  376. ioVNmFls: UInt16;
  377. ioVBitMap: UInt16;
  378. ioAllocPtr: UInt16;
  379. ioVNmAlBlks: UInt16;
  380. ioVAlBlkSiz: UInt32;
  381. ioVClpSiz: UInt32;
  382. ioAlBlSt: UInt16;
  383. ioVNxtCNID: UInt32;
  384. ioVFrBlk: UInt16;
  385. ioVSigWord: UInt16;
  386. ioVDrvInfo: INTEGER;
  387. ioVDRefNum: INTEGER;
  388. ioVFSID: INTEGER;
  389. ioVBkUp: UInt32;
  390. ioVSeqNum: UInt16;
  391. ioVWrCnt: UInt32;
  392. ioVFilCnt: UInt32;
  393. ioVDirCnt: UInt32;
  394. ioVFndrInfo: ARRAY [1..8] OF LONGINT;
  395. );
  396. 3: (
  397. filler3: INTEGER;
  398. ioDenyModes: INTEGER; { access rights data }
  399. filler4: INTEGER;
  400. filler5: SInt8;
  401. ioACUser: SInt8; { access rights for directory only }
  402. filler6: LONGINT;
  403. ioACOwnerID: LONGINT; { owner ID }
  404. ioACGroupID: LONGINT; { group ID }
  405. ioACAccess: LONGINT; { access rights }
  406. );
  407. 4: (
  408. filler7: INTEGER;
  409. ioObjType: INTEGER; { function code }
  410. ioObjNamePtr: StringPtr; { ptr to returned creator/group name }
  411. ioObjID: LONGINT; { creator/group ID }
  412. );
  413. 5: (
  414. ioDstVRefNum: INTEGER; { destination vol identifier }
  415. filler8: INTEGER;
  416. ioNewName: StringPtr; { ptr to destination pathname }
  417. ioCopyName: StringPtr; { ptr to optional name }
  418. ioNewDirID: LONGINT; { destination directory ID }
  419. );
  420. 6: (
  421. ioWDCreated: INTEGER;
  422. ioWDIndex: INTEGER;
  423. ioWDProcID: LONGINT;
  424. ioWDVRefNum: INTEGER;
  425. filler10: INTEGER;
  426. filler11: LONGINT;
  427. filler12: LONGINT;
  428. filler13: LONGINT;
  429. ioWDDirID: LONGINT;
  430. );
  431. 7: (
  432. filler14: LONGINT;
  433. ioDestNamePtr: StringPtr; { dest file name }
  434. filler15: LONGINT;
  435. ioDestDirID: LONGINT; { dest file's directory id }
  436. filler16: LONGINT;
  437. filler17: LONGINT;
  438. ioSrcDirID: LONGINT; { source file's directory id }
  439. filler18: INTEGER;
  440. ioFileID: LONGINT; { file ID }
  441. );
  442. 8: (
  443. ioMatchPtr: FSSpecPtr; { match array }
  444. ioReqMatchCount: LONGINT; { maximum allowable matches }
  445. ioActMatchCount: LONGINT; { actual match count }
  446. ioSearchBits: LONGINT; { search criteria selector }
  447. ioSearchInfo1: CInfoPBPtr; { search values and range lower bounds }
  448. ioSearchInfo2: CInfoPBPtr; { search values and range upper bounds }
  449. ioSearchTime: LONGINT; { length of time to run search }
  450. ioCatPosition: CatPositionRec; { current position in the catalog }
  451. ioOptBuffer: pointer; { optional performance enhancement buffer }
  452. ioOptBufSize: LONGINT; { size of buffer pointed to by ioOptBuffer }
  453. );
  454. 9: (
  455. ioFiller21: LONGINT;
  456. ioFiller22: LONGINT;
  457. ioForeignPrivBuffer: pointer;
  458. ioForeignPrivActCount: LONGINT;
  459. ioForeignPrivReqCount: LONGINT;
  460. ioFiller23: LONGINT;
  461. ioForeignPrivDirID: LONGINT;
  462. ioForeignPrivInfo1: LONGINT;
  463. ioForeignPrivInfo2: LONGINT;
  464. ioForeignPrivInfo3: LONGINT;
  465. ioForeignPrivInfo4: LONGINT;
  466. );
  467. END;
  468. HParmBlkPtr = ^HParamBlockRec;
  469. WDPBRecPtr = ^WDPBRec;
  470. WDPBRec = RECORD
  471. qLink: QElemPtr;
  472. qType: INTEGER;
  473. ioTrap: INTEGER;
  474. ioCmdAddr: pointer;
  475. ioCompletion: IOCompletionUPP;
  476. ioResult: OSErr;
  477. ioNamePtr: StringPtr;
  478. ioVRefNum: INTEGER;
  479. filler1: INTEGER;
  480. ioWDIndex: INTEGER;
  481. ioWDProcID: LONGINT;
  482. ioWDVRefNum: INTEGER;
  483. filler2: ARRAY [1..7] OF INTEGER;
  484. ioWDDirID: LONGINT;
  485. END;
  486. WDPBPtr = ^WDPBRec;
  487. FUNCTION GetVol(volName: StringPtr; VAR vRefNum: INTEGER): OSErr;
  488. external 'InterfaceLib';
  489. function FSpOpenDF(spec: FSSpec; permission: SignedByte;
  490. var refNum: Integer): OSErr;
  491. external 'InterfaceLib';
  492. function FSpCreate(spec: FSSpec; creator, fileType: OSType;
  493. scriptTag: ScriptCode): OSErr;
  494. external 'InterfaceLib';
  495. function FSpDirCreate(spec: FSSpec; scriptTag: ScriptCode;
  496. var createdDirID: Longint): OSErr;
  497. external 'InterfaceLib';
  498. function FSpDelete(spec: FSSpec): OSErr;
  499. external 'InterfaceLib';
  500. FUNCTION FSpSetFLock({CONST}VAR spec: FSSpec): OSErr;
  501. external 'InterfaceLib';
  502. FUNCTION FSpRstFLock({CONST}VAR spec: FSSpec): OSErr;
  503. external 'InterfaceLib';
  504. function FSClose(refNum: Integer): OSErr;
  505. external 'InterfaceLib';
  506. function FSRead(refNum: Integer; var count: Longint; buffPtr: Mac_Ptr): OSErr;
  507. external 'InterfaceLib';
  508. function FSWrite(refNum: Integer; var count: Longint; buffPtr: Mac_Ptr): OSErr;
  509. external 'InterfaceLib';
  510. function GetEOF(refNum: Integer; var logEOF: Longint): OSErr;
  511. external 'InterfaceLib';
  512. function SetEOF(refNum: Integer; logEOF: Longint): OSErr;
  513. external 'InterfaceLib';
  514. function GetFPos(refNum: Integer; var filePos: Longint): OSErr;
  515. external 'InterfaceLib';
  516. function SetFPos(refNum: Integer; posMode: Integer; posOff: Longint): OSErr;
  517. external 'InterfaceLib';
  518. FUNCTION PBGetWDInfoSync(paramBlock: WDPBPtr): OSErr;
  519. external 'InterfaceLib';
  520. function PBGetCatInfoSync (paramBlock: CInfoPBPtr): OSErr;
  521. external 'InterfaceLib';
  522. FUNCTION PBSetCatInfoSync(paramBlock: CInfoPBPtr): OSErr;
  523. external 'InterfaceLib';
  524. FUNCTION PBHGetVInfoSync(paramBlock: HParmBlkPtr): OSErr;
  525. external 'InterfaceLib';
  526. function FSMakeFSSpec (vRefNum: Integer; dirID: LongInt;
  527. fileName: Str255; VAR spec: FSSpec): OSErr;
  528. external 'InterfaceLib';
  529. {************** from Aliases.p ***************}
  530. type
  531. AliasHandle = Mac_Handle;
  532. function NewAliasMinimalFromFullPath(fullPathLength: Integer;
  533. fullPath: Mac_Ptr; zoneName: Str32; serverName: Str31;
  534. var alias: AliasHandle):OSErr;
  535. external 'InterfaceLib';
  536. function ResolveAlias(fromFile: FSSpecPtr; alias: AliasHandle;
  537. var target: FSSpec; var wasChanged: Boolean):OSErr;
  538. external 'InterfaceLib';
  539. {************** from Folders.p ***************}
  540. CONST
  541. kOnSystemDisk = -32768; { previously was 0x8000 but that is an unsigned value whereas vRefNum is signed }
  542. kOnAppropriateDisk = -32767; { Generally, the same as kOnSystemDisk, but it's clearer that this isn't always the 'boot' disk. }
  543. { Folder Domains - Carbon only. The constants above can continue to be used, but the folder/volume returned will }
  544. { be from one of the domains below. }
  545. kSystemDomain = -32766; { Read-only system hierarchy. }
  546. kLocalDomain = -32765; { All users of a single machine have access to these resources. }
  547. kNetworkDomain = -32764; { All users configured to use a common network server has access to these resources. }
  548. kUserDomain = -32763; { Read/write. Resources that are private to the user. }
  549. kClassicDomain = -32762; { Domain referring to the currently configured Classic System Folder }
  550. kCreateFolder = true;
  551. kDontCreateFolder = false;
  552. kSystemFolderType = 'macs'; { the system folder }
  553. kDesktopFolderType = 'desk'; { the desktop folder; objects in this folder show on the desk top. }
  554. kSystemDesktopFolderType = 'sdsk'; { the desktop folder at the root of the hard drive, never the redirected user desktop folder }
  555. kTrashFolderType = 'trsh'; { the trash folder; objects in this folder show up in the trash }
  556. kSystemTrashFolderType = 'strs'; { the trash folder at the root of the drive, never the redirected user trash folder }
  557. kWhereToEmptyTrashFolderType = 'empt'; { the "empty trash" folder; Finder starts empty from here down }
  558. kPrintMonitorDocsFolderType = 'prnt'; { Print Monitor documents }
  559. kStartupFolderType = 'strt'; { Finder objects (applications, documents, DAs, aliases, to...) to open at startup go here }
  560. kShutdownFolderType = 'shdf'; { Finder objects (applications, documents, DAs, aliases, to...) to open at shutdown go here }
  561. kAppleMenuFolderType = 'amnu'; { Finder objects to put into the Apple menu go here }
  562. kControlPanelFolderType = 'ctrl'; { Control Panels go here (may contain INITs) }
  563. kSystemControlPanelFolderType = 'sctl'; { System control panels folder - never the redirected one, always "Control Panels" inside the System Folder }
  564. kExtensionFolderType = 'extn'; { System extensions go here }
  565. kFontsFolderType = 'font'; { Fonts go here }
  566. kPreferencesFolderType = 'pref'; { preferences for applications go here }
  567. kSystemPreferencesFolderType = 'sprf'; { System-type Preferences go here - this is always the system's preferences folder, never a logged in user's }
  568. kTemporaryFolderType = 'temp'; { temporary files go here (deleted periodically, but don't rely on it.) }
  569. FUNCTION FindFolder(vRefNum: INTEGER; folderType: OSType; createFolder: BOOLEAN; VAR foundVRefNum: INTEGER; VAR foundDirID: LONGINT): OSErr;
  570. external 'InterfaceLib';
  571. {************** from Processes.p ***************}
  572. type
  573. ProcessSerialNumber = record
  574. highLongOfPSN: LONGINT;
  575. lowLongOfPSN: LONGINT;
  576. end;
  577. ProcessSerialNumberPtr = ^ProcessSerialNumber;
  578. ProcessInfoRec = record
  579. processInfoLength: LONGINT;
  580. processName: StringPtr;
  581. processNumber: ProcessSerialNumber;
  582. processType: LONGINT;
  583. processSignature: OSType;
  584. processMode: LONGINT;
  585. processLocation: Mac_Ptr;
  586. processSize: LONGINT;
  587. processFreeMem: LONGINT;
  588. processLauncher: ProcessSerialNumber;
  589. processLaunchDate: LONGINT;
  590. processActiveTime: LONGINT;
  591. processAppSpec: FSSpecPtr;
  592. end;
  593. ProcessInfoRecPtr = ^ProcessInfoRec;
  594. const
  595. { Process identifier - Various reserved process serial numbers }
  596. kNoProcess = 0;
  597. kSystemProcess = 1;
  598. kCurrentProcess = 2;
  599. function GetProcessInformation ({CONST} var PSN: ProcessSerialNumber;
  600. var info: ProcessInfoRec): OSErr;
  601. external 'InterfaceLib';
  602. {************** from Script.p ***************}
  603. const
  604. smSystemScript = -1;
  605. {************** from MacErrors.p ***************}
  606. {Contains error codes for all File Manager calls, except
  607. for PBVolumeMount and for File ID Routines (from UI 3.4).
  608. And also memFullErr}
  609. const
  610. dirFulErr = -33; { Directory full }
  611. dskFulErr = -34; { disk full }
  612. nsvErr = -35; { no such volume }
  613. ioErr = -36; { I/O error (bummers) }
  614. bdNamErr = -37; { there may be no bad names in the final system! }
  615. fnOpnErr = -38; { File not open }
  616. eofErr = -39; { End of file }
  617. posErr = -40; { tried to position to before start of file (r/w) }
  618. mFulErr = -41; { memory full (open) or file won't fit (load) }
  619. tmfoErr = -42; { too many files open }
  620. fnfErr = -43; { File not found }
  621. wPrErr = -44; { diskette is write protected. }
  622. fLckdErr = -45; { file is locked }
  623. vLckdErr = -46; { volume is locked }
  624. fBsyErr = -47; { File is busy (delete) }
  625. dupFNErr = -48; { duplicate filename (rename) }
  626. opWrErr = -49; { file already open with with write permission }
  627. rfNumErr = -51; { refnum error }
  628. gfpErr = -52; { get file position error }
  629. volOffLinErr=-53; { volume not on line error (was Ejected) }
  630. permErr = -54; { permissions error (on file open) }
  631. volOnLinErr= -55; { drive volume already on-line at MountVol }
  632. nsDrvErr = -56; { no such drive (tried to mount a bad drive num) }
  633. noMacDskErr= -57; { not a mac diskette (sig bytes are wrong) }
  634. extFSErr = -58; { volume in question belongs to an external fs }
  635. fsRnErr = -59; { file system internal error:during rename the old entry was deleted but could not be restored. }
  636. badMDBErr = -60; { bad master directory block }
  637. wrPermErr = -61; { write permissions error }
  638. dirNFErr = -120; { Directory not found }
  639. tmwdoErr = -121; { No free WDCB available }
  640. badMovErr = -122; { Move into offspring error }
  641. wrgVolTypErr=-123; { Wrong volume type error [operation not supported for MFS] }
  642. volGoneErr = -124; { Server volume has been disconnected. }
  643. diffVolErr = -1303; { files on different volumes }
  644. catChangedErr= -1304; { the catalog has been modified }
  645. afpAccessDenied= -5000; { Insufficient access privileges for operation }
  646. afpDenyConflict= -5006; { Specified open/deny modes conflict with current open modes }
  647. afpNoMoreLocks= -5015; { Maximum lock limit reached }
  648. afpRangeNotLocked= -5020; { Tried to unlock range that was not locked by user }
  649. afpRangeOverlap= -5021; { Some or all of range already locked by same user }
  650. afpObjectTypeErr= -5025; { File/Directory specified where Directory/File expected }
  651. afpCatalogChanged= -5037;
  652. afpSameObjectErr= -5038;
  653. memFullErr = -108; { Not enough room in heap zone }
  654. {************** from Resources ***************}
  655. function GetResource(theType: ResType; theID: Integer): Mac_Handle;
  656. external 'InterfaceLib';
  657. function Get1Resource(theType: ResType; theID: Integer): Mac_Handle;
  658. external 'InterfaceLib';
  659. function GetNamedResource(theType: ResType; name: Str255): Mac_Handle;
  660. external 'InterfaceLib';
  661. function Get1NamedResource(theType: ResType; name: Str255): Mac_Handle;
  662. external 'InterfaceLib';
  663. procedure ReleaseResource(theResource: Mac_Handle);
  664. external 'InterfaceLib';
  665. {************** from DateTimeUtils ***************}
  666. type
  667. DateTimeRecPtr = ^DateTimeRec;
  668. DateTimeRec = RECORD
  669. year: INTEGER;
  670. month: INTEGER;
  671. day: INTEGER;
  672. hour: INTEGER;
  673. minute: INTEGER;
  674. second: INTEGER;
  675. dayOfWeek: INTEGER;
  676. END;
  677. PROCEDURE GetTime(var d: DateTimeRec);
  678. external 'InterfaceLib';
  679. PROCEDURE SetTime(const d: DateTimeRec);
  680. external 'InterfaceLib';
  681. PROCEDURE DateToSeconds({CONST}VAR d: DateTimeRec; VAR secs: UInt32);
  682. external 'InterfaceLib';
  683. PROCEDURE SecondsToDate(secs: UInt32; VAR d: DateTimeRec);
  684. external 'InterfaceLib';
  685. {************** from TextUtils ***************}
  686. PROCEDURE UpperString(VAR theString: Str255; diacSensitive: BOOLEAN);
  687. external 'InterfaceLib';
  688. {************** from others ***************}
  689. procedure ExitToShell;
  690. external 'InterfaceLib';
  691. procedure SysBeep(dur: Integer);
  692. external 'InterfaceLib';
  693. function TickCount: Longint;
  694. external 'InterfaceLib';
  695. function Munger (h: Mac_Handle; offset: LONGINT; ptr1: Mac_Ptr;
  696. len1: LONGINT; ptr2: Mac_Ptr; len2: LONGINT): LONGINT;
  697. external 'InterfaceLib';
  698. {************** misc MPW support routines ***************}
  699. FUNCTION ResolveFolderAliases (volume: INTEGER; directory: LONGINT;
  700. path: StringPtr; resolveLeafName: BOOLEAN;
  701. VAR theSpec: FSSpec; VAR isFolder, hadAlias,
  702. leafIsAlias: BOOLEAN): OSErr;
  703. external 'InterfaceLib'; {??}
  704. { ...from CIncludes:IntEnv.h }
  705. {$PACKRECORDS NORMAL}