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.

566 lines
14 KiB

  1. /*
  2. File: QD3DStorage.h
  3. Contains: Abstraction to deal with various types of stream-based storage devices
  4. Version: Technology: Quickdraw 3D 1.6
  5. Release: QuickTime 7.3
  6. Copyright: (c) 2007 (c) 1995-1999 by Apple Computer, Inc., all rights reserved.
  7. Bugs?: For bug reports, consult the following page on
  8. the World Wide Web:
  9. http://developer.apple.com/bugreporter/
  10. */
  11. #ifndef __QD3DSTORAGE__
  12. #define __QD3DSTORAGE__
  13. #ifndef __QD3D__
  14. #include <QD3D.h>
  15. #endif
  16. #if TARGET_OS_MAC
  17. #ifndef __MACTYPES__
  18. #include <MacTypes.h>
  19. #endif
  20. #ifndef __FILES__
  21. #include <Files.h>
  22. #endif
  23. #endif /* TARGET_OS_MAC */
  24. #if TARGET_OS_WIN32
  25. #include <windows.h>
  26. #endif /* TARGET_OS_WIN32 */
  27. #include <stdio.h>
  28. #if PRAGMA_ONCE
  29. #pragma once
  30. #endif
  31. #ifdef __cplusplus
  32. extern "C" {
  33. #endif
  34. #if PRAGMA_IMPORT
  35. #pragma import on
  36. #endif
  37. #if PRAGMA_STRUCT_ALIGN
  38. #pragma options align=power
  39. #elif PRAGMA_STRUCT_PACKPUSH
  40. #pragma pack(push, 2)
  41. #elif PRAGMA_STRUCT_PACK
  42. #pragma pack(2)
  43. #endif
  44. #if PRAGMA_ENUM_ALWAYSINT
  45. #if defined(__fourbyteints__) && !__fourbyteints__
  46. #define __QD3DSTORAGE__RESTORE_TWOBYTEINTS
  47. #pragma fourbyteints on
  48. #endif
  49. #pragma enumsalwaysint on
  50. #elif PRAGMA_ENUM_OPTIONS
  51. #pragma option enum=int
  52. #elif PRAGMA_ENUM_PACK
  53. #if __option(pack_enums)
  54. #define __QD3DSTORAGE__RESTORE_PACKED_ENUMS
  55. #pragma options(!pack_enums)
  56. #endif
  57. #endif
  58. /******************************************************************************
  59. ** **
  60. ** Storage Routines **
  61. ** **
  62. *****************************************************************************/
  63. #if CALL_NOT_IN_CARBON
  64. /*
  65. * Q3Storage_GetType()
  66. *
  67. * Availability:
  68. * Non-Carbon CFM: not available
  69. * CarbonLib: not available
  70. * Mac OS X: not available
  71. */
  72. EXTERN_API_C( TQ3ObjectType )
  73. Q3Storage_GetType(TQ3StorageObject storage);
  74. /*
  75. * Q3Storage_GetSize()
  76. *
  77. * Availability:
  78. * Non-Carbon CFM: not available
  79. * CarbonLib: not available
  80. * Mac OS X: not available
  81. */
  82. EXTERN_API_C( TQ3Status )
  83. Q3Storage_GetSize(
  84. TQ3StorageObject storage,
  85. unsigned long * size);
  86. /*
  87. * Reads "dataSize" bytes starting at offset in storage, copying into data.
  88. * sizeRead returns the number of bytes filled in.
  89. *
  90. * You may assume if *sizeRead < dataSize, then EOF is at offset + *sizeRead
  91. */
  92. /*
  93. * Q3Storage_GetData()
  94. *
  95. * Availability:
  96. * Non-Carbon CFM: not available
  97. * CarbonLib: not available
  98. * Mac OS X: not available
  99. */
  100. EXTERN_API_C( TQ3Status )
  101. Q3Storage_GetData(
  102. TQ3StorageObject storage,
  103. unsigned long offset,
  104. unsigned long dataSize,
  105. unsigned char * data,
  106. unsigned long * sizeRead);
  107. /*
  108. * Write "dataSize" bytes starting at offset in storage, copying from data.
  109. * sizeWritten returns the number of bytes filled in.
  110. *
  111. * You may assume if *sizeRead < dataSize, then EOF is at offset + *sizeWritten
  112. */
  113. /*
  114. * Q3Storage_SetData()
  115. *
  116. * Availability:
  117. * Non-Carbon CFM: not available
  118. * CarbonLib: not available
  119. * Mac OS X: not available
  120. */
  121. EXTERN_API_C( TQ3Status )
  122. Q3Storage_SetData(
  123. TQ3StorageObject storage,
  124. unsigned long offset,
  125. unsigned long dataSize,
  126. const unsigned char * data,
  127. unsigned long * sizeWritten);
  128. /******************************************************************************
  129. ** **
  130. ** Memory Storage Prototypes **
  131. ** **
  132. *****************************************************************************/
  133. /*
  134. * Q3MemoryStorage_GetType()
  135. *
  136. * Availability:
  137. * Non-Carbon CFM: not available
  138. * CarbonLib: not available
  139. * Mac OS X: not available
  140. */
  141. EXTERN_API_C( TQ3ObjectType )
  142. Q3MemoryStorage_GetType(TQ3StorageObject storage);
  143. /*
  144. * These calls COPY the buffer into QD3D space
  145. */
  146. /*
  147. * Q3MemoryStorage_New()
  148. *
  149. * Availability:
  150. * Non-Carbon CFM: not available
  151. * CarbonLib: not available
  152. * Mac OS X: not available
  153. */
  154. EXTERN_API_C( TQ3StorageObject )
  155. Q3MemoryStorage_New(
  156. const unsigned char * buffer,
  157. unsigned long validSize);
  158. /*
  159. * Q3MemoryStorage_Set()
  160. *
  161. * Availability:
  162. * Non-Carbon CFM: not available
  163. * CarbonLib: not available
  164. * Mac OS X: not available
  165. */
  166. EXTERN_API_C( TQ3Status )
  167. Q3MemoryStorage_Set(
  168. TQ3StorageObject storage,
  169. const unsigned char * buffer,
  170. unsigned long validSize);
  171. /*
  172. * These calls use the pointer given - you must dispose it when you're through
  173. */
  174. #endif /* CALL_NOT_IN_CARBON */
  175. #if CALL_NOT_IN_CARBON
  176. /*
  177. * Q3MemoryStorage_NewBuffer()
  178. *
  179. * Availability:
  180. * Non-Carbon CFM: not available
  181. * CarbonLib: not available
  182. * Mac OS X: not available
  183. */
  184. EXTERN_API_C( TQ3StorageObject )
  185. Q3MemoryStorage_NewBuffer(
  186. unsigned char * buffer,
  187. unsigned long validSize,
  188. unsigned long bufferSize);
  189. /*
  190. * Q3MemoryStorage_SetBuffer()
  191. *
  192. * Availability:
  193. * Non-Carbon CFM: not available
  194. * CarbonLib: not available
  195. * Mac OS X: not available
  196. */
  197. EXTERN_API_C( TQ3Status )
  198. Q3MemoryStorage_SetBuffer(
  199. TQ3StorageObject storage,
  200. unsigned char * buffer,
  201. unsigned long validSize,
  202. unsigned long bufferSize);
  203. /*
  204. * Q3MemoryStorage_GetBuffer()
  205. *
  206. * Availability:
  207. * Non-Carbon CFM: not available
  208. * CarbonLib: not available
  209. * Mac OS X: not available
  210. */
  211. EXTERN_API_C( TQ3Status )
  212. Q3MemoryStorage_GetBuffer(
  213. TQ3StorageObject storage,
  214. unsigned char ** buffer,
  215. unsigned long * validSize,
  216. unsigned long * bufferSize);
  217. #endif /* CALL_NOT_IN_CARBON */
  218. #if TARGET_OS_MAC
  219. /******************************************************************************
  220. ** **
  221. ** Macintosh Handles Prototypes **
  222. ** **
  223. *****************************************************************************/
  224. /* Handle Storage is a subclass of Memory Storage */
  225. #if CALL_NOT_IN_CARBON
  226. /*
  227. * Q3HandleStorage_New()
  228. *
  229. * Availability:
  230. * Non-Carbon CFM: not available
  231. * CarbonLib: not available
  232. * Mac OS X: not available
  233. */
  234. EXTERN_API_C( TQ3StorageObject )
  235. Q3HandleStorage_New(
  236. Handle handle,
  237. unsigned long validSize);
  238. /*
  239. * Q3HandleStorage_Set()
  240. *
  241. * Availability:
  242. * Non-Carbon CFM: not available
  243. * CarbonLib: not available
  244. * Mac OS X: not available
  245. */
  246. EXTERN_API_C( TQ3Status )
  247. Q3HandleStorage_Set(
  248. TQ3StorageObject storage,
  249. Handle handle,
  250. unsigned long validSize);
  251. /*
  252. * Q3HandleStorage_Get()
  253. *
  254. * Availability:
  255. * Non-Carbon CFM: not available
  256. * CarbonLib: not available
  257. * Mac OS X: not available
  258. */
  259. EXTERN_API_C( TQ3Status )
  260. Q3HandleStorage_Get(
  261. TQ3StorageObject storage,
  262. Handle * handle,
  263. unsigned long * validSize);
  264. /******************************************************************************
  265. ** **
  266. ** Macintosh Storage Prototypes **
  267. ** **
  268. *****************************************************************************/
  269. /*
  270. * Q3MacintoshStorage_New()
  271. *
  272. * Availability:
  273. * Non-Carbon CFM: not available
  274. * CarbonLib: not available
  275. * Mac OS X: not available
  276. */
  277. EXTERN_API_C( TQ3StorageObject )
  278. Q3MacintoshStorage_New(short fsRefNum);
  279. /* Note: This storage is assumed open */
  280. /*
  281. * Q3MacintoshStorage_Set()
  282. *
  283. * Availability:
  284. * Non-Carbon CFM: not available
  285. * CarbonLib: not available
  286. * Mac OS X: not available
  287. */
  288. EXTERN_API_C( TQ3Status )
  289. Q3MacintoshStorage_Set(
  290. TQ3StorageObject storage,
  291. short fsRefNum);
  292. /*
  293. * Q3MacintoshStorage_Get()
  294. *
  295. * Availability:
  296. * Non-Carbon CFM: not available
  297. * CarbonLib: not available
  298. * Mac OS X: not available
  299. */
  300. EXTERN_API_C( TQ3Status )
  301. Q3MacintoshStorage_Get(
  302. TQ3StorageObject storage,
  303. short * fsRefNum);
  304. /*
  305. * Q3MacintoshStorage_GetType()
  306. *
  307. * Availability:
  308. * Non-Carbon CFM: not available
  309. * CarbonLib: not available
  310. * Mac OS X: not available
  311. */
  312. EXTERN_API_C( TQ3ObjectType )
  313. Q3MacintoshStorage_GetType(TQ3StorageObject storage);
  314. /******************************************************************************
  315. ** **
  316. ** Macintosh FSSpec Storage Prototypes **
  317. ** **
  318. *****************************************************************************/
  319. /*
  320. * Q3FSSpecStorage_New()
  321. *
  322. * Availability:
  323. * Non-Carbon CFM: not available
  324. * CarbonLib: not available
  325. * Mac OS X: not available
  326. */
  327. EXTERN_API_C( TQ3StorageObject )
  328. Q3FSSpecStorage_New(const FSSpec * fs);
  329. /*
  330. * Q3FSSpecStorage_Set()
  331. *
  332. * Availability:
  333. * Non-Carbon CFM: not available
  334. * CarbonLib: not available
  335. * Mac OS X: not available
  336. */
  337. EXTERN_API_C( TQ3Status )
  338. Q3FSSpecStorage_Set(
  339. TQ3StorageObject storage,
  340. const FSSpec * fs);
  341. /*
  342. * Q3FSSpecStorage_Get()
  343. *
  344. * Availability:
  345. * Non-Carbon CFM: not available
  346. * CarbonLib: not available
  347. * Mac OS X: not available
  348. */
  349. EXTERN_API_C( TQ3Status )
  350. Q3FSSpecStorage_Get(
  351. TQ3StorageObject storage,
  352. FSSpec * fs);
  353. #endif /* CALL_NOT_IN_CARBON */
  354. #endif /* TARGET_OS_MAC */
  355. #if TARGET_OS_WIN32
  356. /******************************************************************************
  357. ** **
  358. ** Win32 HANDLE Storage Prototypes **
  359. ** **
  360. *****************************************************************************/
  361. #if CALL_NOT_IN_CARBON
  362. /*
  363. * Q3Win32Storage_New()
  364. *
  365. * Availability:
  366. * Non-Carbon CFM: not available
  367. * CarbonLib: not available
  368. * Mac OS X: not available
  369. */
  370. EXTERN_API_C( TQ3StorageObject )
  371. Q3Win32Storage_New(HANDLE hFile);
  372. /*
  373. * Q3Win32Storage_Set()
  374. *
  375. * Availability:
  376. * Non-Carbon CFM: not available
  377. * CarbonLib: not available
  378. * Mac OS X: not available
  379. */
  380. EXTERN_API_C( TQ3Status )
  381. Q3Win32Storage_Set(
  382. TQ3StorageObject storage,
  383. HANDLE hFile);
  384. /*
  385. * Q3Win32Storage_Get()
  386. *
  387. * Availability:
  388. * Non-Carbon CFM: not available
  389. * CarbonLib: not available
  390. * Mac OS X: not available
  391. */
  392. EXTERN_API_C( TQ3Status )
  393. Q3Win32Storage_Get(
  394. TQ3StorageObject storage,
  395. HANDLE * hFile);
  396. #endif /* CALL_NOT_IN_CARBON */
  397. #endif /* TARGET_OS_WIN32 */
  398. /******************************************************************************
  399. ** **
  400. ** Unix Prototypes **
  401. ** The Unix Storage prototypes have been obsoleted. **
  402. ** **
  403. *****************************************************************************/
  404. /******************************************************************************
  405. ** **
  406. ** Unix Path Prototypes **
  407. ** **
  408. *****************************************************************************/
  409. #if CALL_NOT_IN_CARBON
  410. /*
  411. * Q3UnixPathStorage_New()
  412. *
  413. * Availability:
  414. * Non-Carbon CFM: not available
  415. * CarbonLib: not available
  416. * Mac OS X: not available
  417. */
  418. EXTERN_API_C( TQ3StorageObject )
  419. Q3UnixPathStorage_New(const char * pathName);
  420. /* C string */
  421. /*
  422. * Q3UnixPathStorage_Set()
  423. *
  424. * Availability:
  425. * Non-Carbon CFM: not available
  426. * CarbonLib: not available
  427. * Mac OS X: not available
  428. */
  429. EXTERN_API_C( TQ3Status )
  430. Q3UnixPathStorage_Set(
  431. TQ3StorageObject storage,
  432. const char * pathName);
  433. /* C string */
  434. /*
  435. * Q3UnixPathStorage_Get()
  436. *
  437. * Availability:
  438. * Non-Carbon CFM: not available
  439. * CarbonLib: not available
  440. * Mac OS X: not available
  441. */
  442. EXTERN_API_C( TQ3Status )
  443. Q3UnixPathStorage_Get(
  444. TQ3StorageObject storage,
  445. char * pathName);
  446. /* pathName is a buffer */
  447. #endif /* CALL_NOT_IN_CARBON */
  448. #if PRAGMA_ENUM_ALWAYSINT
  449. #pragma enumsalwaysint reset
  450. #ifdef __QD3DSTORAGE__RESTORE_TWOBYTEINTS
  451. #pragma fourbyteints off
  452. #endif
  453. #elif PRAGMA_ENUM_OPTIONS
  454. #pragma option enum=reset
  455. #elif defined(__QD3DSTORAGE__RESTORE_PACKED_ENUMS)
  456. #pragma options(pack_enums)
  457. #endif
  458. #if PRAGMA_STRUCT_ALIGN
  459. #pragma options align=reset
  460. #elif PRAGMA_STRUCT_PACKPUSH
  461. #pragma pack(pop)
  462. #elif PRAGMA_STRUCT_PACK
  463. #pragma pack()
  464. #endif
  465. #ifdef PRAGMA_IMPORT_OFF
  466. #pragma import off
  467. #elif PRAGMA_IMPORT
  468. #pragma import reset
  469. #endif
  470. #ifdef __cplusplus
  471. }
  472. #endif
  473. #endif /* __QD3DSTORAGE__ */