Team Fortress 2 Source Code as on 22/4/2020
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1317 lines
35 KiB

  1. /*
  2. File: Resources.h
  3. Contains: Resource Manager Interfaces.
  4. Version: QuickTime 7.3
  5. Copyright: (c) 2007 (c) 1985-2001 by Apple Computer, Inc., all rights reserved
  6. Bugs?: For bug reports, consult the following page on
  7. the World Wide Web:
  8. http://developer.apple.com/bugreporter/
  9. */
  10. #ifndef __RESOURCES__
  11. #define __RESOURCES__
  12. #ifndef __MACTYPES__
  13. #include <MacTypes.h>
  14. #endif
  15. #ifndef __MIXEDMODE__
  16. #include <MixedMode.h>
  17. #endif
  18. #ifndef __FILES__
  19. #include <Files.h>
  20. #endif
  21. #if PRAGMA_ONCE
  22. #pragma once
  23. #endif
  24. #ifdef __cplusplus
  25. extern "C" {
  26. #endif
  27. #if PRAGMA_IMPORT
  28. #pragma import on
  29. #endif
  30. enum {
  31. resSysHeap = 64, /*System or application heap?*/
  32. resPurgeable = 32, /*Purgeable resource?*/
  33. resLocked = 16, /*Load it in locked?*/
  34. resProtected = 8, /*Protected?*/
  35. resPreload = 4, /*Load in on OpenResFile?*/
  36. resChanged = 2, /*Resource changed?*/
  37. mapReadOnly = 128, /*Resource file read-only*/
  38. mapCompact = 64, /*Compact resource file*/
  39. mapChanged = 32 /*Write map out at update*/
  40. };
  41. enum {
  42. resSysRefBit = 7, /*reference to system/local reference*/
  43. resSysHeapBit = 6, /*In system/in application heap*/
  44. resPurgeableBit = 5, /*Purgeable/not purgeable*/
  45. resLockedBit = 4, /*Locked/not locked*/
  46. resProtectedBit = 3, /*Protected/not protected*/
  47. resPreloadBit = 2, /*Read in at OpenResource?*/
  48. resChangedBit = 1, /*Existing resource changed since last update*/
  49. mapReadOnlyBit = 7, /*is this file read-only?*/
  50. mapCompactBit = 6, /*Is a compact necessary?*/
  51. mapChangedBit = 5 /*Is it necessary to write map?*/
  52. };
  53. enum {
  54. kResFileNotOpened = -1, /*ref num return as error when opening a resource file*/
  55. kSystemResFile = 0 /*this is the default ref num to the system file*/
  56. };
  57. typedef CALLBACK_API_REGISTER68K( void , ResErrProcPtr, (OSErr thErr) );
  58. typedef REGISTER_UPP_TYPE(ResErrProcPtr) ResErrUPP;
  59. /*
  60. * NewResErrUPP()
  61. *
  62. * Availability:
  63. * Non-Carbon CFM: available as macro/inline
  64. * CarbonLib: in CarbonLib 1.0 and later
  65. * Mac OS X: in version 10.0 and later
  66. */
  67. EXTERN_API_C( ResErrUPP )
  68. NewResErrUPP(ResErrProcPtr userRoutine);
  69. #if !OPAQUE_UPP_TYPES
  70. enum { uppResErrProcInfo = 0x00001002 }; /* register no_return_value Func(2_bytes:D0) */
  71. #ifdef __cplusplus
  72. inline DEFINE_API_C(ResErrUPP) NewResErrUPP(ResErrProcPtr userRoutine) { return (ResErrUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppResErrProcInfo, GetCurrentArchitecture()); }
  73. #else
  74. #define NewResErrUPP(userRoutine) (ResErrUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppResErrProcInfo, GetCurrentArchitecture())
  75. #endif
  76. #endif
  77. /*
  78. * DisposeResErrUPP()
  79. *
  80. * Availability:
  81. * Non-Carbon CFM: available as macro/inline
  82. * CarbonLib: in CarbonLib 1.0 and later
  83. * Mac OS X: in version 10.0 and later
  84. */
  85. EXTERN_API_C( void )
  86. DisposeResErrUPP(ResErrUPP userUPP);
  87. #if !OPAQUE_UPP_TYPES
  88. #ifdef __cplusplus
  89. inline DEFINE_API_C(void) DisposeResErrUPP(ResErrUPP userUPP) { DisposeRoutineDescriptor((UniversalProcPtr)userUPP); }
  90. #else
  91. #define DisposeResErrUPP(userUPP) DisposeRoutineDescriptor(userUPP)
  92. #endif
  93. #endif
  94. /*
  95. * InvokeResErrUPP()
  96. *
  97. * Availability:
  98. * Non-Carbon CFM: available as macro/inline
  99. * CarbonLib: in CarbonLib 1.0 and later
  100. * Mac OS X: in version 10.0 and later
  101. */
  102. #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  103. #pragma parameter InvokeResErrUPP(__D0, __A0)
  104. #endif
  105. EXTERN_API_C( void )
  106. InvokeResErrUPP(
  107. OSErr thErr,
  108. ResErrUPP userUPP) ONEWORDINLINE(0x4E90);
  109. #if !OPAQUE_UPP_TYPES && (!TARGET_OS_MAC || !TARGET_CPU_68K || TARGET_RT_MAC_CFM)
  110. #ifdef __cplusplus
  111. inline DEFINE_API_C(void) InvokeResErrUPP(OSErr thErr, ResErrUPP userUPP) { CALL_ONE_PARAMETER_UPP(userUPP, uppResErrProcInfo, thErr); }
  112. #else
  113. #define InvokeResErrUPP(thErr, userUPP) CALL_ONE_PARAMETER_UPP((userUPP), uppResErrProcInfo, (thErr))
  114. #endif
  115. #endif
  116. #if CALL_NOT_IN_CARBON || OLDROUTINENAMES
  117. /* support for pre-Carbon UPP routines: New...Proc and Call...Proc */
  118. #define NewResErrProc(userRoutine) NewResErrUPP(userRoutine)
  119. #define CallResErrProc(userRoutine, thErr) InvokeResErrUPP(thErr, userRoutine)
  120. #endif /* CALL_NOT_IN_CARBON */
  121. /* QuickTime 3.0*/
  122. typedef CALLBACK_API( OSErr , ResourceEndianFilterPtr )(Handle theResource, Boolean currentlyNativeEndian);
  123. #if CALL_NOT_IN_CARBON
  124. /*
  125. * InitResources()
  126. *
  127. * Availability:
  128. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  129. * CarbonLib: not available
  130. * Mac OS X: not available
  131. */
  132. EXTERN_API( short )
  133. InitResources(void) ONEWORDINLINE(0xA995);
  134. /*
  135. * RsrcZoneInit()
  136. *
  137. * Availability:
  138. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  139. * CarbonLib: not available
  140. * Mac OS X: not available
  141. */
  142. EXTERN_API( void )
  143. RsrcZoneInit(void) ONEWORDINLINE(0xA996);
  144. #endif /* CALL_NOT_IN_CARBON */
  145. /*
  146. * CloseResFile()
  147. *
  148. * Availability:
  149. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  150. * CarbonLib: in CarbonLib 1.0 and later
  151. * Mac OS X: in version 10.0 and later
  152. */
  153. EXTERN_API( void )
  154. CloseResFile(short refNum) ONEWORDINLINE(0xA99A);
  155. /*
  156. * ResError()
  157. *
  158. * Availability:
  159. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  160. * CarbonLib: in CarbonLib 1.0 and later
  161. * Mac OS X: in version 10.0 and later
  162. */
  163. EXTERN_API( OSErr )
  164. ResError(void) ONEWORDINLINE(0xA9AF);
  165. /*
  166. * CurResFile()
  167. *
  168. * Availability:
  169. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  170. * CarbonLib: in CarbonLib 1.0 and later
  171. * Mac OS X: in version 10.0 and later
  172. */
  173. EXTERN_API( short )
  174. CurResFile(void) ONEWORDINLINE(0xA994);
  175. /*
  176. * HomeResFile()
  177. *
  178. * Availability:
  179. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  180. * CarbonLib: in CarbonLib 1.0 and later
  181. * Mac OS X: in version 10.0 and later
  182. */
  183. EXTERN_API( short )
  184. HomeResFile(Handle theResource) ONEWORDINLINE(0xA9A4);
  185. #if CALL_NOT_IN_CARBON
  186. /*
  187. * CreateResFile()
  188. *
  189. * Availability:
  190. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  191. * CarbonLib: not available
  192. * Mac OS X: not available
  193. */
  194. EXTERN_API( void )
  195. CreateResFile(ConstStr255Param fileName) ONEWORDINLINE(0xA9B1);
  196. /*
  197. * OpenResFile()
  198. *
  199. * Availability:
  200. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  201. * CarbonLib: not available
  202. * Mac OS X: not available
  203. */
  204. EXTERN_API( short )
  205. OpenResFile(ConstStr255Param fileName) ONEWORDINLINE(0xA997);
  206. #endif /* CALL_NOT_IN_CARBON */
  207. /*
  208. * UseResFile()
  209. *
  210. * Availability:
  211. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  212. * CarbonLib: in CarbonLib 1.0 and later
  213. * Mac OS X: in version 10.0 and later
  214. */
  215. EXTERN_API( void )
  216. UseResFile(short refNum) ONEWORDINLINE(0xA998);
  217. /*
  218. * CountTypes()
  219. *
  220. * Availability:
  221. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  222. * CarbonLib: in CarbonLib 1.0 and later
  223. * Mac OS X: in version 10.0 and later
  224. */
  225. EXTERN_API( short )
  226. CountTypes(void) ONEWORDINLINE(0xA99E);
  227. /*
  228. * Count1Types()
  229. *
  230. * Availability:
  231. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  232. * CarbonLib: in CarbonLib 1.0 and later
  233. * Mac OS X: in version 10.0 and later
  234. */
  235. EXTERN_API( short )
  236. Count1Types(void) ONEWORDINLINE(0xA81C);
  237. /*
  238. * GetIndType()
  239. *
  240. * Availability:
  241. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  242. * CarbonLib: in CarbonLib 1.0 and later
  243. * Mac OS X: in version 10.0 and later
  244. */
  245. EXTERN_API( void )
  246. GetIndType(
  247. ResType * theType,
  248. short index) ONEWORDINLINE(0xA99F);
  249. /*
  250. * Get1IndType()
  251. *
  252. * Availability:
  253. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  254. * CarbonLib: in CarbonLib 1.0 and later
  255. * Mac OS X: in version 10.0 and later
  256. */
  257. EXTERN_API( void )
  258. Get1IndType(
  259. ResType * theType,
  260. short index) ONEWORDINLINE(0xA80F);
  261. /*
  262. * SetResLoad()
  263. *
  264. * Availability:
  265. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  266. * CarbonLib: in CarbonLib 1.0 and later
  267. * Mac OS X: in version 10.0 and later
  268. */
  269. EXTERN_API( void )
  270. SetResLoad(Boolean load) ONEWORDINLINE(0xA99B);
  271. /*
  272. * CountResources()
  273. *
  274. * Availability:
  275. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  276. * CarbonLib: in CarbonLib 1.0 and later
  277. * Mac OS X: in version 10.0 and later
  278. */
  279. EXTERN_API( short )
  280. CountResources(ResType theType) ONEWORDINLINE(0xA99C);
  281. /*
  282. * Count1Resources()
  283. *
  284. * Availability:
  285. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  286. * CarbonLib: in CarbonLib 1.0 and later
  287. * Mac OS X: in version 10.0 and later
  288. */
  289. EXTERN_API( short )
  290. Count1Resources(ResType theType) ONEWORDINLINE(0xA80D);
  291. /*
  292. * GetIndResource()
  293. *
  294. * Availability:
  295. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  296. * CarbonLib: in CarbonLib 1.0 and later
  297. * Mac OS X: in version 10.0 and later
  298. */
  299. EXTERN_API( Handle )
  300. GetIndResource(
  301. ResType theType,
  302. short index) ONEWORDINLINE(0xA99D);
  303. /*
  304. * Get1IndResource()
  305. *
  306. * Availability:
  307. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  308. * CarbonLib: in CarbonLib 1.0 and later
  309. * Mac OS X: in version 10.0 and later
  310. */
  311. EXTERN_API( Handle )
  312. Get1IndResource(
  313. ResType theType,
  314. short index) ONEWORDINLINE(0xA80E);
  315. /*
  316. * GetResource()
  317. *
  318. * Availability:
  319. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  320. * CarbonLib: in CarbonLib 1.0 and later
  321. * Mac OS X: in version 10.0 and later
  322. */
  323. EXTERN_API( Handle )
  324. GetResource(
  325. ResType theType,
  326. short theID) ONEWORDINLINE(0xA9A0);
  327. /*
  328. * Get1Resource()
  329. *
  330. * Availability:
  331. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  332. * CarbonLib: in CarbonLib 1.0 and later
  333. * Mac OS X: in version 10.0 and later
  334. */
  335. EXTERN_API( Handle )
  336. Get1Resource(
  337. ResType theType,
  338. short theID) ONEWORDINLINE(0xA81F);
  339. /*
  340. * GetNamedResource()
  341. *
  342. * Availability:
  343. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  344. * CarbonLib: in CarbonLib 1.0 and later
  345. * Mac OS X: in version 10.0 and later
  346. */
  347. EXTERN_API( Handle )
  348. GetNamedResource(
  349. ResType theType,
  350. ConstStr255Param name) ONEWORDINLINE(0xA9A1);
  351. /*
  352. * Get1NamedResource()
  353. *
  354. * Availability:
  355. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  356. * CarbonLib: in CarbonLib 1.0 and later
  357. * Mac OS X: in version 10.0 and later
  358. */
  359. EXTERN_API( Handle )
  360. Get1NamedResource(
  361. ResType theType,
  362. ConstStr255Param name) ONEWORDINLINE(0xA820);
  363. /*
  364. * [Mac]LoadResource()
  365. *
  366. * Availability:
  367. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  368. * CarbonLib: in CarbonLib 1.0 and later
  369. * Mac OS X: in version 10.0 and later
  370. */
  371. #if TARGET_OS_MAC
  372. #define MacLoadResource LoadResource
  373. #endif
  374. EXTERN_API( void )
  375. MacLoadResource(Handle theResource) ONEWORDINLINE(0xA9A2);
  376. /*
  377. * ReleaseResource()
  378. *
  379. * Availability:
  380. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  381. * CarbonLib: in CarbonLib 1.0 and later
  382. * Mac OS X: in version 10.0 and later
  383. */
  384. EXTERN_API( void )
  385. ReleaseResource(Handle theResource) ONEWORDINLINE(0xA9A3);
  386. /*
  387. * DetachResource()
  388. *
  389. * Availability:
  390. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  391. * CarbonLib: in CarbonLib 1.0 and later
  392. * Mac OS X: in version 10.0 and later
  393. */
  394. EXTERN_API( void )
  395. DetachResource(Handle theResource) ONEWORDINLINE(0xA992);
  396. /*
  397. * UniqueID()
  398. *
  399. * Availability:
  400. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  401. * CarbonLib: in CarbonLib 1.0 and later
  402. * Mac OS X: in version 10.0 and later
  403. */
  404. EXTERN_API( short )
  405. UniqueID(ResType theType) ONEWORDINLINE(0xA9C1);
  406. /*
  407. * Unique1ID()
  408. *
  409. * Availability:
  410. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  411. * CarbonLib: in CarbonLib 1.0 and later
  412. * Mac OS X: in version 10.0 and later
  413. */
  414. EXTERN_API( short )
  415. Unique1ID(ResType theType) ONEWORDINLINE(0xA810);
  416. /*
  417. * GetResAttrs()
  418. *
  419. * Availability:
  420. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  421. * CarbonLib: in CarbonLib 1.0 and later
  422. * Mac OS X: in version 10.0 and later
  423. */
  424. EXTERN_API( short )
  425. GetResAttrs(Handle theResource) ONEWORDINLINE(0xA9A6);
  426. /*
  427. * GetResInfo()
  428. *
  429. * Availability:
  430. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  431. * CarbonLib: in CarbonLib 1.0 and later
  432. * Mac OS X: in version 10.0 and later
  433. */
  434. EXTERN_API( void )
  435. GetResInfo(
  436. Handle theResource,
  437. short * theID,
  438. ResType * theType,
  439. Str255 name) ONEWORDINLINE(0xA9A8);
  440. /*
  441. * SetResInfo()
  442. *
  443. * Availability:
  444. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  445. * CarbonLib: in CarbonLib 1.0 and later
  446. * Mac OS X: in version 10.0 and later
  447. */
  448. EXTERN_API( void )
  449. SetResInfo(
  450. Handle theResource,
  451. short theID,
  452. ConstStr255Param name) ONEWORDINLINE(0xA9A9);
  453. /*
  454. * AddResource()
  455. *
  456. * Availability:
  457. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  458. * CarbonLib: in CarbonLib 1.0 and later
  459. * Mac OS X: in version 10.0 and later
  460. */
  461. EXTERN_API( void )
  462. AddResource(
  463. Handle theData,
  464. ResType theType,
  465. short theID,
  466. ConstStr255Param name) ONEWORDINLINE(0xA9AB);
  467. /*
  468. * GetResourceSizeOnDisk()
  469. *
  470. * Availability:
  471. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  472. * CarbonLib: in CarbonLib 1.0 and later
  473. * Mac OS X: in version 10.0 and later
  474. */
  475. EXTERN_API( long )
  476. GetResourceSizeOnDisk(Handle theResource) ONEWORDINLINE(0xA9A5);
  477. /*
  478. * GetMaxResourceSize()
  479. *
  480. * Availability:
  481. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  482. * CarbonLib: in CarbonLib 1.0 and later
  483. * Mac OS X: in version 10.0 and later
  484. */
  485. EXTERN_API( long )
  486. GetMaxResourceSize(Handle theResource) ONEWORDINLINE(0xA821);
  487. #if CALL_NOT_IN_CARBON
  488. /*
  489. * RsrcMapEntry()
  490. *
  491. * Availability:
  492. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  493. * CarbonLib: not available
  494. * Mac OS X: not available
  495. */
  496. EXTERN_API( long )
  497. RsrcMapEntry(Handle theResource) ONEWORDINLINE(0xA9C5);
  498. #endif /* CALL_NOT_IN_CARBON */
  499. /*
  500. * SetResAttrs()
  501. *
  502. * Availability:
  503. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  504. * CarbonLib: in CarbonLib 1.0 and later
  505. * Mac OS X: in version 10.0 and later
  506. */
  507. EXTERN_API( void )
  508. SetResAttrs(
  509. Handle theResource,
  510. short attrs) ONEWORDINLINE(0xA9A7);
  511. /*
  512. * ChangedResource()
  513. *
  514. * Availability:
  515. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  516. * CarbonLib: in CarbonLib 1.0 and later
  517. * Mac OS X: in version 10.0 and later
  518. */
  519. EXTERN_API( void )
  520. ChangedResource(Handle theResource) ONEWORDINLINE(0xA9AA);
  521. /*
  522. * RemoveResource()
  523. *
  524. * Availability:
  525. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  526. * CarbonLib: in CarbonLib 1.0 and later
  527. * Mac OS X: in version 10.0 and later
  528. */
  529. EXTERN_API( void )
  530. RemoveResource(Handle theResource) ONEWORDINLINE(0xA9AD);
  531. /*
  532. * UpdateResFile()
  533. *
  534. * Availability:
  535. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  536. * CarbonLib: in CarbonLib 1.0 and later
  537. * Mac OS X: in version 10.0 and later
  538. */
  539. EXTERN_API( void )
  540. UpdateResFile(short refNum) ONEWORDINLINE(0xA999);
  541. /*
  542. * WriteResource()
  543. *
  544. * Availability:
  545. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  546. * CarbonLib: in CarbonLib 1.0 and later
  547. * Mac OS X: in version 10.0 and later
  548. */
  549. EXTERN_API( void )
  550. WriteResource(Handle theResource) ONEWORDINLINE(0xA9B0);
  551. /*
  552. * SetResPurge()
  553. *
  554. * Availability:
  555. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  556. * CarbonLib: in CarbonLib 1.0 and later
  557. * Mac OS X: in version 10.0 and later
  558. */
  559. EXTERN_API( void )
  560. SetResPurge(Boolean install) ONEWORDINLINE(0xA993);
  561. /*
  562. * GetResFileAttrs()
  563. *
  564. * Availability:
  565. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  566. * CarbonLib: in CarbonLib 1.0 and later
  567. * Mac OS X: in version 10.0 and later
  568. */
  569. EXTERN_API( short )
  570. GetResFileAttrs(short refNum) ONEWORDINLINE(0xA9F6);
  571. /*
  572. * SetResFileAttrs()
  573. *
  574. * Availability:
  575. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  576. * CarbonLib: in CarbonLib 1.0 and later
  577. * Mac OS X: in version 10.0 and later
  578. */
  579. EXTERN_API( void )
  580. SetResFileAttrs(
  581. short refNum,
  582. short attrs) ONEWORDINLINE(0xA9F7);
  583. /*
  584. * OpenRFPerm()
  585. *
  586. * Availability:
  587. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  588. * CarbonLib: in CarbonLib 1.0 and later
  589. * Mac OS X: in version 10.0 and later
  590. */
  591. EXTERN_API( short )
  592. OpenRFPerm(
  593. ConstStr255Param fileName,
  594. short vRefNum,
  595. SInt8 permission) ONEWORDINLINE(0xA9C4);
  596. #if CALL_NOT_IN_CARBON
  597. /*
  598. * RGetResource()
  599. *
  600. * Availability:
  601. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  602. * CarbonLib: not available
  603. * Mac OS X: not available
  604. */
  605. EXTERN_API( Handle )
  606. RGetResource(
  607. ResType theType,
  608. short theID) ONEWORDINLINE(0xA80C);
  609. #endif /* CALL_NOT_IN_CARBON */
  610. /*
  611. * HOpenResFile()
  612. *
  613. * Availability:
  614. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  615. * CarbonLib: in CarbonLib 1.0 and later
  616. * Mac OS X: in version 10.0 and later
  617. */
  618. EXTERN_API( short )
  619. HOpenResFile(
  620. short vRefNum,
  621. long dirID,
  622. ConstStr255Param fileName,
  623. SInt8 permission) ONEWORDINLINE(0xA81A);
  624. /*
  625. * HCreateResFile()
  626. *
  627. * Availability:
  628. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  629. * CarbonLib: in CarbonLib 1.0 and later
  630. * Mac OS X: in version 10.0 and later
  631. */
  632. EXTERN_API( void )
  633. HCreateResFile(
  634. short vRefNum,
  635. long dirID,
  636. ConstStr255Param fileName) ONEWORDINLINE(0xA81B);
  637. /*
  638. * FSpOpenResFile()
  639. *
  640. * Availability:
  641. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  642. * CarbonLib: in CarbonLib 1.0 and later
  643. * Mac OS X: in version 10.0 and later
  644. */
  645. EXTERN_API( short )
  646. FSpOpenResFile(
  647. const FSSpec * spec,
  648. SignedByte permission) TWOWORDINLINE(0x700D, 0xAA52);
  649. /*
  650. * FSpCreateResFile()
  651. *
  652. * Availability:
  653. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  654. * CarbonLib: in CarbonLib 1.0 and later
  655. * Mac OS X: in version 10.0 and later
  656. */
  657. EXTERN_API( void )
  658. FSpCreateResFile(
  659. const FSSpec * spec,
  660. OSType creator,
  661. OSType fileType,
  662. ScriptCode scriptTag) TWOWORDINLINE(0x700E, 0xAA52);
  663. /*
  664. * ReadPartialResource()
  665. *
  666. * Availability:
  667. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  668. * CarbonLib: in CarbonLib 1.0 and later
  669. * Mac OS X: in version 10.0 and later
  670. */
  671. EXTERN_API( void )
  672. ReadPartialResource(
  673. Handle theResource,
  674. long offset,
  675. void * buffer,
  676. long count) TWOWORDINLINE(0x7001, 0xA822);
  677. /*
  678. * WritePartialResource()
  679. *
  680. * Availability:
  681. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  682. * CarbonLib: in CarbonLib 1.0 and later
  683. * Mac OS X: in version 10.0 and later
  684. */
  685. EXTERN_API( void )
  686. WritePartialResource(
  687. Handle theResource,
  688. long offset,
  689. const void * buffer,
  690. long count) TWOWORDINLINE(0x7002, 0xA822);
  691. /*
  692. * SetResourceSize()
  693. *
  694. * Availability:
  695. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  696. * CarbonLib: in CarbonLib 1.0 and later
  697. * Mac OS X: in version 10.0 and later
  698. */
  699. EXTERN_API( void )
  700. SetResourceSize(
  701. Handle theResource,
  702. long newSize) TWOWORDINLINE(0x7003, 0xA822);
  703. /*
  704. * GetNextFOND()
  705. *
  706. * Availability:
  707. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  708. * CarbonLib: in CarbonLib 1.0 and later
  709. * Mac OS X: in version 10.0 and later
  710. */
  711. EXTERN_API( Handle )
  712. GetNextFOND(Handle fondHandle) TWOWORDINLINE(0x700A, 0xA822);
  713. /* QuickTime 3.0*/
  714. #if CALL_NOT_IN_CARBON
  715. /*
  716. * RegisterResourceEndianFilter()
  717. *
  718. * Availability:
  719. * Non-Carbon CFM: not available
  720. * CarbonLib: not available
  721. * Mac OS X: not available
  722. */
  723. EXTERN_API_C( OSErr )
  724. RegisterResourceEndianFilter(
  725. ResType theType,
  726. ResourceEndianFilterPtr theFilterProc);
  727. /* Use TempInsertROMMap to force the ROM resource map to be
  728. inserted into the chain in front of the system. Note that
  729. this call is only temporary - the modified resource chain
  730. is only used for the next call to the resource manager.
  731. See IM IV 19 for more information.
  732. */
  733. /*
  734. * TempInsertROMMap()
  735. *
  736. * Availability:
  737. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  738. * CarbonLib: not available
  739. * Mac OS X: not available
  740. */
  741. EXTERN_API( void )
  742. TempInsertROMMap(Boolean tempResLoad) FIVEWORDINLINE(0x70FF, 0x4A1F, 0x56C0, 0x31C0, 0x0B9E);
  743. /*
  744. _________________________________________________________________________________________________________
  745. o RESOURCE CHAIN LOCATION - for use with the Resource Manager chain manipulation routines under Carbon.
  746. _________________________________________________________________________________________________________
  747. */
  748. #endif /* CALL_NOT_IN_CARBON */
  749. typedef SInt16 RsrcChainLocation;
  750. enum {
  751. kRsrcChainBelowSystemMap = 0, /* Below the system's resource map*/
  752. kRsrcChainBelowApplicationMap = 1, /* Below the application's resource map*/
  753. kRsrcChainAboveApplicationMap = 2, /* Above the application's resource map*/
  754. kRsrcChainAboveAllMaps = 4 /* Above all resource maps*/
  755. };
  756. /*
  757. If the file is already in the resource chain, it is removed and re-inserted at the specified location
  758. If the file has been detached, it is added to the resource chain at the specified location
  759. Returns resFNotFound if it's not currently open.
  760. */
  761. /*
  762. * InsertResourceFile()
  763. *
  764. * Availability:
  765. * Non-Carbon CFM: not available
  766. * CarbonLib: in CarbonLib 1.0 and later
  767. * Mac OS X: in version 10.0 and later
  768. */
  769. EXTERN_API( OSErr )
  770. InsertResourceFile(
  771. SInt16 refNum,
  772. RsrcChainLocation where);
  773. /*
  774. If the file is not currently in the resource chain, this returns resNotFound
  775. Otherwise, the resource file is removed from the resource chain.
  776. */
  777. /*
  778. * DetachResourceFile()
  779. *
  780. * Availability:
  781. * Non-Carbon CFM: not available
  782. * CarbonLib: in CarbonLib 1.0 and later
  783. * Mac OS X: in version 10.0 and later
  784. */
  785. EXTERN_API( OSErr )
  786. DetachResourceFile(SInt16 refNum);
  787. /*
  788. Returns true if the resource file is already open and known by the Resource Manager (i.e., it is
  789. either in the current resource chain or it's a detached resource file.) If it's in the resource
  790. chain, the inChain Boolean is set to true on exit and true is returned. If it's an open file, but
  791. the file is currently detached, inChain is set to false and true is returned. If the file is open,
  792. the refNum to the file is returned.
  793. */
  794. /*
  795. * FSpResourceFileAlreadyOpen()
  796. *
  797. * Availability:
  798. * Non-Carbon CFM: in InterfaceLib 9.0 and later
  799. * CarbonLib: in CarbonLib 1.0 and later
  800. * Mac OS X: in version 10.0 and later
  801. */
  802. EXTERN_API( Boolean )
  803. FSpResourceFileAlreadyOpen(
  804. const FSSpec * resourceFile,
  805. Boolean * inChain,
  806. SInt16 * refNum) TWOWORDINLINE(0x7010, 0xA822);
  807. /*
  808. FSpOpenOrphanResFile should be used to open a resource file that is persistent across all contexts,
  809. because using OpenResFile normally loads a map and all preloaded resources into the application
  810. context. FSpOpenOrphanResFile loads everything into the system context and detaches the file
  811. from the context in which it was opened. If the file is already in the resource chain and a new
  812. instance is not opened, FSpOpenOrphanResFile will return a paramErr.
  813. Use with care, as can and will fail if the map is very large or a lot of preload
  814. resources exist.
  815. */
  816. /*
  817. * FSpOpenOrphanResFile()
  818. *
  819. * Availability:
  820. * Non-Carbon CFM: not available
  821. * CarbonLib: in CarbonLib 1.0 and later
  822. * Mac OS X: in version 10.0 and later
  823. */
  824. EXTERN_API( OSErr )
  825. FSpOpenOrphanResFile(
  826. const FSSpec * spec,
  827. SignedByte permission,
  828. SInt16 * refNum);
  829. /*
  830. GetTopResourceFile returns the refNum of the top most resource map in the current resource chain. If
  831. the resource chain is empty it returns resFNotFound.
  832. */
  833. /*
  834. * GetTopResourceFile()
  835. *
  836. * Availability:
  837. * Non-Carbon CFM: not available
  838. * CarbonLib: in CarbonLib 1.0.2 and later
  839. * Mac OS X: in version 10.0 and later
  840. */
  841. EXTERN_API( OSErr )
  842. GetTopResourceFile(SInt16 * refNum);
  843. /*
  844. GetNextResourceFile can be used to iterate over resource files in the resource chain. By passing a
  845. valid refNum in curRefNum it will return in nextRefNum the refNum of the next file in
  846. the chain. If curRefNum is not found in the resource chain, GetNextResourceFile returns resFNotFound.
  847. When the end of the chain is reached GetNextResourceFile will return noErr and nextRefNum will be NIL.
  848. */
  849. /*
  850. * GetNextResourceFile()
  851. *
  852. * Availability:
  853. * Non-Carbon CFM: not available
  854. * CarbonLib: in CarbonLib 1.0.2 and later
  855. * Mac OS X: in version 10.0 and later
  856. */
  857. EXTERN_API( OSErr )
  858. GetNextResourceFile(
  859. SInt16 curRefNum,
  860. SInt16 * nextRefNum);
  861. #if CALL_NOT_IN_CARBON
  862. /*
  863. * getnamedresource()
  864. *
  865. * Availability:
  866. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  867. * CarbonLib: not available
  868. * Mac OS X: not available
  869. */
  870. EXTERN_API_C( Handle )
  871. getnamedresource(
  872. ResType theType,
  873. const char * name);
  874. /*
  875. * get1namedresource()
  876. *
  877. * Availability:
  878. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  879. * CarbonLib: not available
  880. * Mac OS X: not available
  881. */
  882. EXTERN_API_C( Handle )
  883. get1namedresource(
  884. ResType theType,
  885. const char * name);
  886. /*
  887. * openrfperm()
  888. *
  889. * Availability:
  890. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  891. * CarbonLib: not available
  892. * Mac OS X: not available
  893. */
  894. EXTERN_API_C( short )
  895. openrfperm(
  896. const char * fileName,
  897. short vRefNum,
  898. char permission);
  899. /*
  900. * openresfile()
  901. *
  902. * Availability:
  903. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  904. * CarbonLib: not available
  905. * Mac OS X: not available
  906. */
  907. EXTERN_API_C( short )
  908. openresfile(const char * fileName);
  909. /*
  910. * createresfile()
  911. *
  912. * Availability:
  913. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  914. * CarbonLib: not available
  915. * Mac OS X: not available
  916. */
  917. EXTERN_API_C( void )
  918. createresfile(const char * fileName);
  919. /*
  920. * getresinfo()
  921. *
  922. * Availability:
  923. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  924. * CarbonLib: not available
  925. * Mac OS X: not available
  926. */
  927. EXTERN_API_C( void )
  928. getresinfo(
  929. Handle theResource,
  930. short * theID,
  931. ResType * theType,
  932. char * name);
  933. /*
  934. * setresinfo()
  935. *
  936. * Availability:
  937. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  938. * CarbonLib: not available
  939. * Mac OS X: not available
  940. */
  941. EXTERN_API_C( void )
  942. setresinfo(
  943. Handle theResource,
  944. short theID,
  945. const char * name);
  946. /*
  947. * addresource()
  948. *
  949. * Availability:
  950. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  951. * CarbonLib: not available
  952. * Mac OS X: not available
  953. */
  954. EXTERN_API_C( void )
  955. addresource(
  956. Handle theResource,
  957. ResType theType,
  958. short theID,
  959. const char * name);
  960. #endif /* CALL_NOT_IN_CARBON */
  961. #if OLDROUTINENAMES
  962. #define SizeResource(theResource) GetResourceSizeOnDisk(theResource)
  963. #define MaxSizeRsrc(theResource) GetMaxResourceSize(theResource)
  964. #define RmveResource(theResource) RemoveResource(theResource)
  965. #endif /* OLDROUTINENAMES */
  966. /*
  967. * FSCreateResourceFile()
  968. *
  969. * Summary:
  970. * Creates a new resource file.
  971. *
  972. * Discussion:
  973. * This function creates a new file and initializes the specified
  974. * named fork as an empty resource fork. This function allows for
  975. * the creation of data fork only files which can be used for
  976. * storing resources. Passing in a null name defaults to using the
  977. * data fork.
  978. *
  979. * Parameters:
  980. *
  981. * parentRef:
  982. * The directory where the file is to be created
  983. *
  984. * nameLength:
  985. * Number of Unicode characters in the file's name
  986. *
  987. * name:
  988. * A pointer to the Unicode name
  989. *
  990. * whichInfo:
  991. * Which catalog info fields to set
  992. *
  993. * catalogInfo:
  994. * The values for catalog info fields to set; may be NULL
  995. *
  996. * forkNameLength:
  997. * The length of the fork name (in Unicode characters)
  998. *
  999. * forkName:
  1000. * The name of the fork to initialize (in Unicode); may be NULL
  1001. *
  1002. * newRef:
  1003. * A pointer to the FSRef for the new file; may be NULL
  1004. *
  1005. * newSpec:
  1006. * A pointer to the FSSpec for the new directory; may be NULL
  1007. *
  1008. * Availability:
  1009. * Non-Carbon CFM: not available
  1010. * CarbonLib: in CarbonLib 1.3 and later
  1011. * Mac OS X: in version 10.0 and later
  1012. */
  1013. EXTERN_API( OSErr )
  1014. FSCreateResourceFile(
  1015. const FSRef * parentRef,
  1016. UniCharCount nameLength,
  1017. const UniChar * name,
  1018. FSCatalogInfoBitmap whichInfo,
  1019. const FSCatalogInfo * catalogInfo, /* can be NULL */
  1020. UniCharCount forkNameLength,
  1021. const UniChar * forkName, /* can be NULL */
  1022. FSRef * newRef, /* can be NULL */
  1023. FSSpec * newSpec); /* can be NULL */
  1024. /*
  1025. * FSCreateResourceFork()
  1026. *
  1027. * Summary:
  1028. * Creates the named forked and initializes it as an empty resource
  1029. * fork.
  1030. *
  1031. * Discussion:
  1032. * This function allows a resource fork to be added to an existing
  1033. * file. Passing in a null forkname will result in the data fork
  1034. * being used. If the named fork already exists this function does
  1035. * nothing and returns errFSForkExists.
  1036. *
  1037. * Parameters:
  1038. *
  1039. * ref:
  1040. * The file to add the fork to
  1041. *
  1042. * forkNameLength:
  1043. * The length of the fork name (in Unicode characters)
  1044. *
  1045. * forkName:
  1046. * The name of the fork to open (in Unicode); may be NULL
  1047. *
  1048. * flags:
  1049. * Pass in zero
  1050. *
  1051. * Availability:
  1052. * Non-Carbon CFM: not available
  1053. * CarbonLib: not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
  1054. * Mac OS X: in version 10.2 and later
  1055. */
  1056. EXTERN_API_C( OSErr )
  1057. FSCreateResourceFork(
  1058. const FSRef * ref,
  1059. UniCharCount forkNameLength,
  1060. const UniChar * forkName, /* can be NULL */
  1061. UInt32 flags);
  1062. /*
  1063. * FSOpenResourceFile()
  1064. *
  1065. * Summary:
  1066. * Opens the specified named fork as a resource fork.
  1067. *
  1068. * Discussion:
  1069. * This function allows any named fork of a file to be used for
  1070. * storing resources. Passing in a null forkname will result in the
  1071. * data fork being used.
  1072. *
  1073. * Parameters:
  1074. *
  1075. * ref:
  1076. * The file containing the fork to open
  1077. *
  1078. * forkNameLength:
  1079. * The length of the fork name (in Unicode characters)
  1080. *
  1081. * forkName:
  1082. * The name of the fork to open (in Unicode); may be NULL
  1083. *
  1084. * permissions:
  1085. * The access (read and/or write) you want
  1086. *
  1087. * refNum:
  1088. * On exit the reference number for accessing the open fork
  1089. *
  1090. * Availability:
  1091. * Non-Carbon CFM: not available
  1092. * CarbonLib: in CarbonLib 1.3 and later
  1093. * Mac OS X: in version 10.0 and later
  1094. */
  1095. EXTERN_API( OSErr )
  1096. FSOpenResourceFile(
  1097. const FSRef * ref,
  1098. UniCharCount forkNameLength,
  1099. const UniChar * forkName, /* can be NULL */
  1100. SInt8 permissions,
  1101. SInt16 * refNum);
  1102. /*
  1103. These typedefs were originally created for the Copland Resource Mangager
  1104. */
  1105. typedef short ResFileRefNum;
  1106. typedef short ResID;
  1107. typedef short ResAttributes;
  1108. typedef short ResFileAttributes;
  1109. #if CALL_NOT_IN_CARBON
  1110. /*
  1111. * SortResourceFile()
  1112. *
  1113. * Availability:
  1114. * Non-Carbon CFM: in InterfaceLib 9.2 and later
  1115. * CarbonLib: not available
  1116. * Mac OS X: not available
  1117. */
  1118. EXTERN_API( void )
  1119. SortResourceFile(short resFileRefNum) TWOWORDINLINE(0x7016, 0xA822);
  1120. #endif /* CALL_NOT_IN_CARBON */
  1121. #ifdef PRAGMA_IMPORT_OFF
  1122. #pragma import off
  1123. #elif PRAGMA_IMPORT
  1124. #pragma import reset
  1125. #endif
  1126. #ifdef __cplusplus
  1127. }
  1128. #endif
  1129. #endif /* __RESOURCES__ */